From 68dfa704b3ea872e9af637d83c573cbeeab30692 Mon Sep 17 00:00:00 2001 From: vmittal-msft <46945843+vmittal-msft@users.noreply.github.com> Date: Fri, 30 Apr 2021 10:02:08 -0700 Subject: [PATCH 001/136] Updated Qos/MMU settings for Arista-7050CX3-32S-C32 & Arista-7050CX3-32S-D48C8 (#7068) * TD3 Qos/MMU settings for Arista-7050CX3-32S-C32 & Arista-7050CX3-32S-D48C8 --- .../Arista-7050CX3-32S-C32/buffers.json.j2 | 2 + .../buffers_defaults_t0.j2 | 46 ++++++++++++++++++ .../pg_profile_lookup.ini | 8 ++++ .../Arista-7050CX3-32S-C32/qos.json.j2 | 1 + .../td3-a7050cx3-32s-32x100G.config.bcm | 7 ++- .../Arista-7050CX3-32S-D48C8/buffers.json.j2 | 2 + .../buffers_defaults_t0.j2 | 47 +++++++++++++++++++ .../pg_profile_lookup.ini | 8 ++++ .../Arista-7050CX3-32S-D48C8/qos.json.j2 | 1 + .../td3-a7050cx3-32s-48x50G+8x100G.config.bcm | 5 ++ src/sonic-device-data/tests/permitted_list | 4 ++ 11 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/buffers.json.j2 create mode 100644 device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/buffers_defaults_t0.j2 create mode 100644 device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/pg_profile_lookup.ini create mode 100644 device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/qos.json.j2 create mode 100644 device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/buffers.json.j2 create mode 100644 device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/buffers_defaults_t0.j2 create mode 100644 device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/pg_profile_lookup.ini create mode 100644 device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/qos.json.j2 diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/buffers.json.j2 b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/buffers.json.j2 new file mode 100644 index 000000000000..1083a6210fc9 --- /dev/null +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/buffers.json.j2 @@ -0,0 +1,2 @@ +{%- set default_topo = 't0' %} +{%- include 'buffers_config.j2' %} diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..f5b7327e705d --- /dev/null +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/buffers_defaults_t0.j2 @@ -0,0 +1,46 @@ +{%- set default_cable = '300m' %} + +{%- 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": "32712448", + "type": "ingress", + "mode": "dynamic", + "xoff": "1622016" + }, + "egress_lossy_pool": { + "size": "24709632", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "32599040", + "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", + "static_th":"32599040" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1792", + "dynamic_th":"-1" + } + }, +{%- endmacro %} diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/pg_profile_lookup.ini b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/pg_profile_lookup.ini new file mode 100644 index 000000000000..e30c3aeae2e0 --- /dev/null +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/pg_profile_lookup.ini @@ -0,0 +1,8 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 50000 5m 4608 4608 33792 -3 4608 + 100000 5m 4608 4608 49408 -3 4608 + 50000 40m 4608 4608 36352 -3 4608 + 100000 40m 4608 4608 54528 -3 4608 + 50000 300m 4608 4608 55296 -3 4608 + 100000 300m 4608 4608 92672 -3 4608 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 100644 index 000000000000..3e548325ea30 --- /dev/null +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/qos.json.j2 @@ -0,0 +1 @@ +{%- include 'qos_config.j2' %} 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 5536bda517d8..c93de2859539 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 @@ -48,6 +48,11 @@ robust_hash_disable_vlan=1 stable_size=0x5500000 tdma_timeout_usec=15000000 tslam_timeout_usec=15000000 +sai_optimized_mmu=1 +mmu_init_config="TD3-MSFT-T0-100G" +buf.map.egress_pool0.ingress_pool=0 +buf.map.egress_pool1.ingress_pool=0 +buf.map.egress_pool2.ingress_pool=1 phy_chain_rx_lane_map_physical{1.0}=0x1302 phy_chain_rx_lane_map_physical{101.0}=0x0213 phy_chain_rx_lane_map_physical{105.0}=0x2031 @@ -509,4 +514,4 @@ serdes_preemphasis_119=0x14410a serdes_preemphasis_123=0x14410a serdes_preemphasis_127=0x14410a serdes_driver_current_130=0xe -serdes_preemphasis_130=0x102804 +serdes_preemphasis_130=0x102804 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/buffers.json.j2 b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/buffers.json.j2 new file mode 100644 index 000000000000..1083a6210fc9 --- /dev/null +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/buffers.json.j2 @@ -0,0 +1,2 @@ +{%- set default_topo = 't0' %} +{%- include 'buffers_config.j2' %} diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..e4d43cf75c23 --- /dev/null +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/buffers_defaults_t0.j2 @@ -0,0 +1,47 @@ + +{%- set default_cable = '300m' %} + +{%- 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": "32669440", + "type": "ingress", + "mode": "dynamic", + "xoff": "2058240" + }, + "egress_lossy_pool": { + "size": "24192256", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "32340992", + "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", + "static_th":"32340992" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1792", + "dynamic_th":"-1" + } + }, +{%- endmacro %} diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/pg_profile_lookup.ini b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/pg_profile_lookup.ini new file mode 100644 index 000000000000..44880400d0f6 --- /dev/null +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/pg_profile_lookup.ini @@ -0,0 +1,8 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 50000 5m 4608 4608 79872 -3 4608 + 100000 5m 4608 4608 54528 -3 4608 + 50000 40m 4608 4608 39936 -3 4608 + 100000 40m 4608 4608 60416 -3 4608 + 50000 300m 4608 4608 61440 -3 4608 + 100000 300m 4608 4608 103680 -3 4608 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 new file mode 100644 index 000000000000..3e548325ea30 --- /dev/null +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/qos.json.j2 @@ -0,0 +1 @@ +{%- 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 5ec69f685ebc..1204e2dcb6ab 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 @@ -48,6 +48,11 @@ robust_hash_disable_vlan=1 stable_size=0x5500000 tdma_timeout_usec=15000000 tslam_timeout_usec=15000000 +sai_optimized_mmu=1 +mmu_init_config="TD3-MSFT-T0-50G" +buf.map.egress_pool0.ingress_pool=0 +buf.map.egress_pool1.ingress_pool=0 +buf.map.egress_pool2.ingress_pool=1 phy_chain_rx_lane_map_physical{1.0}=0x1302 phy_chain_rx_lane_map_physical{5.0}=0x3120 phy_chain_rx_lane_map_physical{9.0}=0x3120 diff --git a/src/sonic-device-data/tests/permitted_list b/src/sonic-device-data/tests/permitted_list index 997250cbf6b8..f152140e9070 100644 --- a/src/sonic-device-data/tests/permitted_list +++ b/src/sonic-device-data/tests/permitted_list @@ -230,3 +230,7 @@ pbmp_gport_stack reglist_enable scache_filename host_as_route_disable +sai_optimized_mmu +buf.map.egress_pool0.ingress_pool +buf.map.egress_pool1.ingress_pool +buf.map.egress_pool2.ingress_pool From 5da004675515ad2173ba3a37c4eb157754992dfd Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Fri, 30 Apr 2021 13:04:15 -0700 Subject: [PATCH 002/136] [makefile] define a do-nothing target for config.user (#7483) Why I did it After PR #7344, 'make init' and/or 'make reset' will also build sonic slave dockers. '-include rules/config.user' is supposed to be fine when the file is missing. However, when the file is missing, it generates a delayed error which later causes make init and make reset trying to build the sonic slave dockers. How I did it Define a do-nothing target for config.user to catch config.user build therefore preventing other builds to be triggered unexpectedly. How to verify it did make init and it is now only doing submodule init. --- Makefile.work | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile.work b/Makefile.work index 591ea051d98f..6577e5aebbb9 100644 --- a/Makefile.work +++ b/Makefile.work @@ -99,6 +99,11 @@ else SLAVE_DIR = sonic-slave-jessie endif +# Define a do-nothing target for rules/config.user so that when +# the file is missing, make won't try to rebuld everything. +rules/config.user: + @echo -n "" + include rules/config -include rules/config.user From 668a678e5ee9cbc966e3390961b8972c4313cf14 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak <38952541+stepanblyschak@users.noreply.github.com> Date: Sat, 1 May 2021 01:45:04 +0300 Subject: [PATCH 003/136] [sonic-utilities] update sonic-utilities submodule (#7481) 08337aa [sonic-package-manager] first phase implementation of sonic-package-manager (#1527) c166f66 [multi-asic] support show ip bgp neigh/network for multi asic (#1574) Signed-off-by: Stepan Blyschak --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 9dba93fd9619..08337aa7637b 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 9dba93fd96194d70ee181ed48f439bc4f3c00b82 +Subproject commit 08337aa7637b290bb8407c38b2a5dbe3e8383b3e From 1b394245201c5af743c0bb47eea8b45e92015fa1 Mon Sep 17 00:00:00 2001 From: Lawrence Lee Date: Fri, 30 Apr 2021 16:30:30 -0700 Subject: [PATCH 004/136] [docker-orchagent]: Increase ndppd kernel poll interval (#7456) Why I did it ndppd by default reads /proc/net/ipv6_route ever 30 seconds. Since T1s advertise so many routes to ToRs, this file is extremely large, and reading it causes ndppd's CPU usage to spike every 30 seconds How I did it Increase the delay for reading this file to the maximum possible value (max integer value), which will result in CPU spikes every ~24 days instead of every 30 seconds How to verify it Start ndppd with the new config file, confirm that no CPU spikes are seen except at startup Signed-off-by: Lawrence Lee --- dockers/docker-orchagent/ndppd.conf.j2 | 2 +- src/sonic-config-engine/tests/sample_output/py2/ndppd.conf | 1 + src/sonic-config-engine/tests/sample_output/py3/ndppd.conf | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dockers/docker-orchagent/ndppd.conf.j2 b/dockers/docker-orchagent/ndppd.conf.j2 index bc375f3c4987..dbb70734680d 100644 --- a/dockers/docker-orchagent/ndppd.conf.j2 +++ b/dockers/docker-orchagent/ndppd.conf.j2 @@ -21,7 +21,7 @@ {% set _x = proxy_interfaces[intf].append(prefix) %} {% endif %} {% endfor -%} - +route-ttl 2147483647 {% for intf, prefix_list in proxy_interfaces.items() %} {% if prefix_list %} diff --git a/src/sonic-config-engine/tests/sample_output/py2/ndppd.conf b/src/sonic-config-engine/tests/sample_output/py2/ndppd.conf index 71ff1dfaf9ca..edae81fffdb4 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/ndppd.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/ndppd.conf @@ -4,6 +4,7 @@ # # Config file for ndppd, the NDP Proxy Daemon # See man page for ndppd.conf.5 for descriptions of all available options +route-ttl 2147483647 proxy Vlan1000 { rule fc02:1000::/64 { diff --git a/src/sonic-config-engine/tests/sample_output/py3/ndppd.conf b/src/sonic-config-engine/tests/sample_output/py3/ndppd.conf index 28a239006d24..66117155cdbf 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/ndppd.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/ndppd.conf @@ -4,6 +4,7 @@ # # Config file for ndppd, the NDP Proxy Daemon # See man page for ndppd.conf.5 for descriptions of all available options +route-ttl 2147483647 proxy Vlan1000 { rule fc01:1000::/64 { From a10542e894b7d26a369c552ca071d75b2cab5e38 Mon Sep 17 00:00:00 2001 From: Shilong Liu Date: Sat, 1 May 2021 07:35:38 +0800 Subject: [PATCH 005/136] [CI] Add Bldenv pipeline files (#7458) Add 3 pipeline files: - pipeline for build docker image sonic-slave-[buster|jessie|stretch] for amd64/armhf/arm64, and push to ACR(sonicdev-microsoft.com) - pipeline for build docker image sonic-mgmt, and push to ACR - pipeline for cleaning dpkg cache which are created more than 30 days. Co-authored-by: lguohan --- .azure-pipelines/docker-sonic-mgmt.yml | 57 +++++++++++++ .azure-pipelines/docker-sonic-slave.yml | 106 ++++++++++++++++++++++++ .azure-pipelines/dpkg-cache-cleanup.yml | 27 ++++++ 3 files changed, 190 insertions(+) create mode 100644 .azure-pipelines/docker-sonic-mgmt.yml create mode 100644 .azure-pipelines/docker-sonic-slave.yml create mode 100644 .azure-pipelines/dpkg-cache-cleanup.yml diff --git a/.azure-pipelines/docker-sonic-mgmt.yml b/.azure-pipelines/docker-sonic-mgmt.yml new file mode 100644 index 000000000000..4dc9aee9bb89 --- /dev/null +++ b/.azure-pipelines/docker-sonic-mgmt.yml @@ -0,0 +1,57 @@ +# 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-mgmt image + +schedules: +- cron: "0 8 * * *" + branches: + include: + - master + always: true + +trigger: none +pr: + branches: + include: + - master + paths: + include: + - dockers/docker-sonic-mgmt + +parameters: +- name: registry_url + type: string + default: sonicdev-microsoft.azurecr.io +- name: registry_conn + type: string + default: sonicdev + +stages: +- stage: Build + jobs: + - job: Build + pool: sonicbld + timeoutInMinutes: 360 + steps: + - template: cleanup.yml + - checkout: self + clean: true + submodules: recursive + - bash: | + set -xe + make configure PLATFORM=generic + make target/docker-sonic-mgmt.gz + docker load -i target/docker-sonic-mgmt.gz + docker tag docker-sonic-mgmt $REGISTRY_SERVER/docker-sonic-mgmt:latest + env: + REGISTRY_SERVER: ${{ parameters.registry_url }} + displayName: Build docker-sonic-mgmt.gz + - task: Docker@2 + displayName: Upload image + inputs: + containerRegistry: ${{ parameters.registry_conn }} + repository: docker-sonic-mgmt + command: push + tags: latest diff --git a/.azure-pipelines/docker-sonic-slave.yml b/.azure-pipelines/docker-sonic-slave.yml new file mode 100644 index 000000000000..1da5f4c911ee --- /dev/null +++ b/.azure-pipelines/docker-sonic-slave.yml @@ -0,0 +1,106 @@ +# 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 + +schedules: +- cron: "0 8 * * *" + branches: + include: + - master + always: true + +trigger: none +pr: + branches: + include: + - master + paths: + include: + - sonic-slave-jessie + - sonic-slave-stretch + - sonic-slave-buster + +parameters: +- name: 'arches' + type: object + default: + - amd64 + - armhf + - arm64 +- name: 'dists' + type: object + default: + - buster + - stretch + - jessie +- name: registry_url + type: string + default: sonicdev-microsoft.azurecr.io +- name: registry_conn + type: string + default: sonicdev + +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 }} 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 diff --git a/.azure-pipelines/dpkg-cache-cleanup.yml b/.azure-pipelines/dpkg-cache-cleanup.yml new file mode 100644 index 000000000000..2789d1818819 --- /dev/null +++ b/.azure-pipelines/dpkg-cache-cleanup.yml @@ -0,0 +1,27 @@ +# 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 +# Clean up the cache 30 days ago + +schedules: +- cron: "0 0 * * *" + branches: + include: + - master + always: true + +trigger: none +pr: none + +jobs: +- job: Build + pool: sonicbld + timeoutInMinutes: 5 + steps: + - checkout: none + - script: | + set -xe + sudo find /nfs/dpkg_cache/ -name *.tgz -mtime +30 -type f -delete + displayName: clean dpkg cache + From 78b45085e9cb98da45c39ca9ad809734f2cd15b1 Mon Sep 17 00:00:00 2001 From: a-barboza <29963827+a-barboza@users.noreply.github.com> Date: Sat, 1 May 2021 10:25:20 -0700 Subject: [PATCH 006/136] [radius] Management User Authentication Feature Issue (#7420) (#7503) Fix Invalid file name in windows, having ':' charactor. #7420 --- src/sonic-host-services-data/templates/common-auth-sonic.j2 | 6 +++--- src/sonic-host-services/scripts/hostcfgd | 2 +- .../RADIUS/{10.10.10.1:1645.conf => 10.10.10.1_1645.conf} | 0 .../RADIUS/{10.10.10.2:1645.conf => 10.10.10.2_1645.conf} | 0 .../tests/hostcfgd/sample_output/RADIUS/common-auth-sonic | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) rename src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/{10.10.10.1:1645.conf => 10.10.10.1_1645.conf} (100%) rename src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/{10.10.10.2:1645.conf => 10.10.10.2_1645.conf} (100%) diff --git a/src/sonic-host-services-data/templates/common-auth-sonic.j2 b/src/sonic-host-services-data/templates/common-auth-sonic.j2 index 7435d47644b7..a890556a36c0 100644 --- a/src/sonic-host-services-data/templates/common-auth-sonic.j2 +++ b/src/sonic-host-services-data/templates/common-auth-sonic.j2 @@ -32,7 +32,7 @@ auth [success=1 default=ignore] pam_unix.so nullok try_first_pass auth [success=done new_authtok_reqd=done default=ignore{{ ' auth_err=die maxtries=die' if not auth['failthrough'] }}] pam_unix.so nullok try_first_pass # For the RADIUS servers, on success jump to the cacheing the MPL(Privilege) {% for server in servers %} -auth [success={{ (servers | count) - loop.index0 }} new_authtok_reqd=done default=ignore{{ ' auth_err=die' if not auth['failthrough'] }}] pam_radius_auth.so conf=/etc/pam_radius_auth.d/{{ server.ip }}:{{ server.auth_port }}.conf privilege_level protocol={{ server.auth_type }} retry={{ server.retransmit }}{% if server.nas_ip is defined %} nas_ip_address={{ server.nas_ip }}{% endif %}{% if server.nas_id is defined %} client_id={{ server.nas_id }}{% endif %}{% if debug %} debug{% endif %}{% if trace %} trace{% endif %}{% if server.statistics %} statistics={{ server.ip }}{% endif %} try_first_pass +auth [success={{ (servers | count) - loop.index0 }} new_authtok_reqd=done default=ignore{{ ' auth_err=die' if not auth['failthrough'] }}] pam_radius_auth.so conf=/etc/pam_radius_auth.d/{{ server.ip }}_{{ server.auth_port }}.conf privilege_level protocol={{ server.auth_type }} retry={{ server.retransmit }}{% if server.nas_ip is defined %} nas_ip_address={{ server.nas_ip }}{% endif %}{% if server.nas_id is defined %} client_id={{ server.nas_id }}{% endif %}{% if debug %} debug{% endif %}{% if trace %} trace{% endif %}{% if server.statistics %} statistics={{ server.ip }}{% endif %} try_first_pass {% endfor %} auth requisite pam_deny.so # Cache MPL(Privilege) @@ -43,7 +43,7 @@ auth [success=1 default=ignore] pam_exec.so /usr/sbin/cache_radius auth [success={{ (servers | count) }} default=ignore] pam_succeed_if.so user = root # For the RADIUS servers, on success jump to the cache the MPL(Privilege) {% for server in servers %} -auth [success={{ (servers | count) + 1 - loop.index0 }} new_authtok_reqd=done default=ignore{{ ' auth_err=die' if not auth['failthrough'] }}] pam_radius_auth.so conf=/etc/pam_radius_auth.d/{{ server.ip }}:{{ server.auth_port }}.conf privilege_level protocol={{ server.auth_type }} retry={{ server.retransmit }}{% if server.nas_ip is defined %} nas_ip_address={{ server.nas_ip }}{% endif %}{% if server.nas_id is defined %} client_id={{ server.nas_id }}{% endif %}{% if debug %} debug{% endif %}{% if trace %} trace{% endif %}{% if server.statistics %} statistics={{ server.ip }}{% endif %} try_first_pass +auth [success={{ (servers | count) + 1 - loop.index0 }} new_authtok_reqd=done default=ignore{{ ' auth_err=die' if not auth['failthrough'] }}] pam_radius_auth.so conf=/etc/pam_radius_auth.d/{{ server.ip }}_{{ server.auth_port }}.conf privilege_level protocol={{ server.auth_type }} retry={{ server.retransmit }}{% if server.nas_ip is defined %} nas_ip_address={{ server.nas_ip }}{% endif %}{% if server.nas_id is defined %} client_id={{ server.nas_id }}{% endif %}{% if debug %} debug{% endif %}{% if trace %} trace{% endif %}{% if server.statistics %} statistics={{ server.ip }}{% endif %} try_first_pass {% endfor %} # Local auth [success=done new_authtok_reqd=done default=ignore{{ ' auth_err=die maxtries=die' if not auth['failthrough'] }}] pam_unix.so nullok try_first_pass @@ -56,7 +56,7 @@ auth [success=1 default=ignore] pam_exec.so /usr/sbin/cache_radius auth [success={{ (servers | count) + 2 }} default=ignore] pam_succeed_if.so user = root # For the RADIUS servers, on success jump to the cache the MPL(Privilege) {% for server in servers %} -auth [success={{ (servers | count) - loop.index0 }} new_authtok_reqd=done default=ignore{{ ' auth_err=die' if not auth['failthrough'] }}] pam_radius_auth.so conf=/etc/pam_radius_auth.d/{{ server.ip }}:{{ server.auth_port }}.conf privilege_level protocol={{ server.auth_type }} retry={{ server.retransmit }}{% if server.nas_ip is defined %} nas_ip_address={{ server.nas_ip }}{% endif %}{% if server.nas_id is defined %} client_id={{ server.nas_id }}{% endif %}{% if debug %} debug{% endif %}{% if trace %} trace{% endif %}{% if server.statistics %} statistics={{ server.ip }}{% endif %} try_first_pass +auth [success={{ (servers | count) - loop.index0 }} new_authtok_reqd=done default=ignore{{ ' auth_err=die' if not auth['failthrough'] }}] pam_radius_auth.so conf=/etc/pam_radius_auth.d/{{ server.ip }}_{{ server.auth_port }}.conf privilege_level protocol={{ server.auth_type }} retry={{ server.retransmit }}{% if server.nas_ip is defined %} nas_ip_address={{ server.nas_ip }}{% endif %}{% if server.nas_id is defined %} client_id={{ server.nas_id }}{% endif %}{% if debug %} debug{% endif %}{% if trace %} trace{% endif %}{% if server.statistics %} statistics={{ server.ip }}{% endif %} try_first_pass {% endfor %} auth requisite pam_deny.so # Cache MPL(Privilege) diff --git a/src/sonic-host-services/scripts/hostcfgd b/src/sonic-host-services/scripts/hostcfgd index 7f4482121d30..053b78e528b6 100755 --- a/src/sonic-host-services/scripts/hostcfgd +++ b/src/sonic-host-services/scripts/hostcfgd @@ -458,7 +458,7 @@ class AaaCfg(object): if radsrvs_conf: for srv in radsrvs_conf: # Configuration File - pam_radius_auth_file = RADIUS_PAM_AUTH_CONF_DIR + srv['ip'] + ":" + srv['auth_port'] + ".conf" + pam_radius_auth_file = RADIUS_PAM_AUTH_CONF_DIR + srv['ip'] + "_" + srv['auth_port'] + ".conf" template_file = os.path.abspath(PAM_RADIUS_AUTH_CONF_TEMPLATE) template = env.get_template(template_file) pam_radius_auth_conf = template.render(server=srv) diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/10.10.10.1:1645.conf b/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/10.10.10.1_1645.conf similarity index 100% rename from src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/10.10.10.1:1645.conf rename to src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/10.10.10.1_1645.conf diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/10.10.10.2:1645.conf b/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/10.10.10.2_1645.conf similarity index 100% rename from src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/10.10.10.2:1645.conf rename to src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/10.10.10.2_1645.conf diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/common-auth-sonic b/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/common-auth-sonic index 12294d0c4d4e..d6b148633eb8 100644 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/common-auth-sonic +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/common-auth-sonic @@ -12,8 +12,8 @@ # root user can only be authenticated locally. Jump to local. auth [success=2 default=ignore] pam_succeed_if.so user = root # For the RADIUS servers, on success jump to the cache the MPL(Privilege) -auth [success=3 new_authtok_reqd=done default=ignore auth_err=die] pam_radius_auth.so conf=/etc/pam_radius_auth.d/10.10.10.1:1645.conf privilege_level protocol=pap retry=1 nas_ip_address=10.10.10.10 debug try_first_pass -auth [success=2 new_authtok_reqd=done default=ignore auth_err=die] pam_radius_auth.so conf=/etc/pam_radius_auth.d/10.10.10.2:1645.conf privilege_level protocol=chap retry=2 nas_ip_address=10.10.10.10 debug try_first_pass +auth [success=3 new_authtok_reqd=done default=ignore auth_err=die] pam_radius_auth.so conf=/etc/pam_radius_auth.d/10.10.10.1_1645.conf privilege_level protocol=pap retry=1 nas_ip_address=10.10.10.10 debug try_first_pass +auth [success=2 new_authtok_reqd=done default=ignore auth_err=die] pam_radius_auth.so conf=/etc/pam_radius_auth.d/10.10.10.2_1645.conf privilege_level protocol=chap retry=2 nas_ip_address=10.10.10.10 debug try_first_pass # Local auth [success=done new_authtok_reqd=done default=ignore auth_err=die maxtries=die] pam_unix.so nullok try_first_pass auth requisite pam_deny.so From be4cf09b5ddac134b0f76456f6d46ff29d4b6f12 Mon Sep 17 00:00:00 2001 From: guxianghong Date: Sun, 2 May 2021 01:37:07 +0800 Subject: [PATCH 007/136] [Centec][arm64] support new board E530-48s4x and E530-24x2q (#7189) 1. support new board E530-48s4x E530-24x2q 2. optimize platform driver for Centec TsingMa board Co-authored-by: shi lei --- .../E530-24x2c/port_config.ini | 54 +- .../arm64-centec_e530_24x2c-r0/fancontrol | 11 + .../platform_components.json | 8 + .../platform_reboot | 11 + .../plugins/eeprom.py | 4 +- .../plugins/led_control.py | 123 +- .../plugins/psuutil.py | 5 +- .../plugins/sfputil.py | 221 +-- .../pmon_daemon_control.json | 3 + .../E530-24x2q/buffers.json.j2 | 70 + .../E530-24x2q/pg_profile_lookup.ini | 21 + .../E530-24x2q/port_config.ini | 27 + .../E530-24x2q/qos.json.j2 | 1 + .../E530-24x2q/sai.profile | 2 + .../arm64-centec_e530_24x2q-r0/default_sku | 1 + .../arm64-centec_e530_24x2q-r0/fancontrol | 12 + .../arm64-centec_e530_24x2q-r0/installer.conf | 0 .../platform_components.json | 8 + .../platform_reboot | 11 + .../plugins/eeprom.py | 22 + .../plugins/led_control.py | 165 +++ .../plugins/psuutil.py | 72 + .../plugins/sfputil.py | 200 +++ .../pmon_daemon_control.json | 3 + .../E530-48s4x/buffers.json.j2 | 70 + .../E530-48s4x/pg_profile_lookup.ini | 21 + .../E530-48s4x/port_config.ini | 53 + .../E530-48s4x/qos.json.j2 | 1 + .../E530-48s4x/sai.profile | 2 + .../arm64-centec_e530_48s4x-r0/default_sku | 1 + .../arm64-centec_e530_48s4x-r0/fancontrol | 12 + .../arm64-centec_e530_48s4x-r0/installer.conf | 0 .../platform_components.json | 8 + .../platform_reboot | 12 + .../plugins/eeprom.py | 22 + .../plugins/led_control.py | 98 ++ .../plugins/psuutil.py | 72 + .../plugins/sfputil.py | 161 +++ .../pmon_daemon_control.json | 3 + .../E530-48t4x-p/port_config.ini | 106 +- .../arm64-centec_e530_48t4x_p-r0/fancontrol | 11 + .../platform_components.json | 8 + .../platform_reboot | 11 + .../plugins/eeprom.py | 4 +- .../plugins/led_control.py | 9 +- .../plugins/psuutil.py | 5 +- .../plugins/sfputil.py | 78 +- .../pmon_daemon_control.json | 3 + .../plugins/sfputil.py | 2 +- platform/centec-arm64/one-image.mk | 2 + .../platform-modules-centec-e530.mk | 14 +- platform/centec-arm64/platform.conf | 62 +- platform/centec-arm64/sai.mk | 2 +- .../24x2c/setup.py | 8 +- .../24x2c/sonic_platform/__init__.py | 3 + .../24x2c/sonic_platform/chassis.py | 203 +++ .../24x2c/sonic_platform/eeprom.py | 111 ++ .../24x2c/sonic_platform/fan.py | 186 +++ .../24x2c/sonic_platform/fan_drawer.py | 36 + .../24x2c/sonic_platform/platform.py | 21 + .../24x2c/sonic_platform/psu.py | 45 + .../24x2c/sonic_platform/sfp.py | 102 ++ .../24x2c/sonic_platform/thermal.py | 118 ++ .../24x2q/modules/Makefile | 1 + .../modules/centec_e530_24x2q_platform.c | 1111 ++++++++++++++++ .../24x2q/service/24x2q_platform.service | 13 + .../24x2q/setup.py | 15 + .../24x2q/sonic_platform/__init__.py | 3 + .../24x2q/sonic_platform/chassis.py | 203 +++ .../24x2q/sonic_platform/eeprom.py | 111 ++ .../24x2q/sonic_platform/fan.py | 186 +++ .../24x2q/sonic_platform/fan_drawer.py | 36 + .../24x2q/sonic_platform/platform.py | 21 + .../24x2q/sonic_platform/psu.py | 45 + .../24x2q/sonic_platform/sfp.py | 102 ++ .../24x2q/sonic_platform/thermal.py | 118 ++ .../48s4x/modules/Makefile | 1 + .../modules/centec_e530_48s4x_platform.c | 1184 +++++++++++++++++ .../48s4x/service/48s4x_platform.service | 13 + .../48s4x/setup.py | 15 + .../48s4x/sonic_platform/__init__.py | 3 + .../48s4x/sonic_platform/chassis.py | 173 +++ .../48s4x/sonic_platform/eeprom.py | 111 ++ .../48s4x/sonic_platform/fan.py | 186 +++ .../48s4x/sonic_platform/fan_drawer.py | 36 + .../48s4x/sonic_platform/platform.py | 21 + .../48s4x/sonic_platform/psu.py | 45 + .../48s4x/sonic_platform/sfp.py | 102 ++ .../48s4x/sonic_platform/thermal.py | 118 ++ .../{48t4x_p => 48t4x-p}/modules/Makefile | 0 .../modules/centec_e530_48t4x_p_platform.c | 83 +- .../service/48t4x_p_platform.service | 0 .../{48t4x_p => 48t4x-p}/setup.py | 8 +- .../48t4x-p/sonic_platform/__init__.py | 3 + .../48t4x-p/sonic_platform/chassis.py | 173 +++ .../48t4x-p/sonic_platform/eeprom.py | 111 ++ .../48t4x-p/sonic_platform/fan.py | 186 +++ .../48t4x-p/sonic_platform/fan_drawer.py | 36 + .../48t4x-p/sonic_platform/platform.py | 21 + .../48t4x-p/sonic_platform/psu.py | 45 + .../48t4x-p/sonic_platform/sfp.py | 102 ++ .../48t4x-p/sonic_platform/thermal.py | 118 ++ .../debian/changelog | 12 + .../debian/control | 10 + .../debian/platform-modules-e530-24x2c.init | 21 + .../platform-modules-e530-24x2c.install | 5 +- .../debian/platform-modules-e530-24x2q.init | 82 ++ .../platform-modules-e530-24x2q.install | 2 + .../platform-modules-e530-24x2q.postinst | 2 + .../debian/platform-modules-e530-48s4x.init | 82 ++ .../platform-modules-e530-48s4x.install | 2 + .../platform-modules-e530-48s4x.postinst | 2 + .../debian/platform-modules-e530-48t4x-p.init | 21 + .../platform-modules-e530-48t4x-p.install | 5 +- .../sonic-platform-modules-e530/debian/rules | 23 +- .../sonic-platform-modules-e530/fan/Makefile | 1 + .../fan/fan-ctc5236.c | 268 ++++ platform/centec/centec-dal/dal_common.h | 66 +- platform/centec/centec-dal/dal_kernel.c | 471 ++++--- platform/centec/centec-dal/dal_kernel.h | 20 +- platform/centec/centec-dal/dal_mpool.c | 33 +- 121 files changed, 8258 insertions(+), 470 deletions(-) create mode 100644 device/centec/arm64-centec_e530_24x2c-r0/platform_components.json create mode 100755 device/centec/arm64-centec_e530_24x2c-r0/platform_reboot create mode 100644 device/centec/arm64-centec_e530_24x2c-r0/pmon_daemon_control.json create mode 100644 device/centec/arm64-centec_e530_24x2q-r0/E530-24x2q/buffers.json.j2 create mode 100644 device/centec/arm64-centec_e530_24x2q-r0/E530-24x2q/pg_profile_lookup.ini create mode 100644 device/centec/arm64-centec_e530_24x2q-r0/E530-24x2q/port_config.ini create mode 100644 device/centec/arm64-centec_e530_24x2q-r0/E530-24x2q/qos.json.j2 create mode 100644 device/centec/arm64-centec_e530_24x2q-r0/E530-24x2q/sai.profile create mode 100644 device/centec/arm64-centec_e530_24x2q-r0/default_sku create mode 100644 device/centec/arm64-centec_e530_24x2q-r0/fancontrol rename platform/centec-arm64/sonic-platform-modules-e530/24x2c/classes/__init__.py => device/centec/arm64-centec_e530_24x2q-r0/installer.conf (100%) create mode 100644 device/centec/arm64-centec_e530_24x2q-r0/platform_components.json create mode 100755 device/centec/arm64-centec_e530_24x2q-r0/platform_reboot create mode 100644 device/centec/arm64-centec_e530_24x2q-r0/plugins/eeprom.py create mode 100644 device/centec/arm64-centec_e530_24x2q-r0/plugins/led_control.py create mode 100644 device/centec/arm64-centec_e530_24x2q-r0/plugins/psuutil.py create mode 100644 device/centec/arm64-centec_e530_24x2q-r0/plugins/sfputil.py create mode 100644 device/centec/arm64-centec_e530_24x2q-r0/pmon_daemon_control.json create mode 100644 device/centec/arm64-centec_e530_48s4x-r0/E530-48s4x/buffers.json.j2 create mode 100644 device/centec/arm64-centec_e530_48s4x-r0/E530-48s4x/pg_profile_lookup.ini create mode 100644 device/centec/arm64-centec_e530_48s4x-r0/E530-48s4x/port_config.ini create mode 100644 device/centec/arm64-centec_e530_48s4x-r0/E530-48s4x/qos.json.j2 create mode 100644 device/centec/arm64-centec_e530_48s4x-r0/E530-48s4x/sai.profile create mode 100644 device/centec/arm64-centec_e530_48s4x-r0/default_sku create mode 100644 device/centec/arm64-centec_e530_48s4x-r0/fancontrol rename platform/centec-arm64/sonic-platform-modules-e530/48t4x_p/classes/__init__.py => device/centec/arm64-centec_e530_48s4x-r0/installer.conf (100%) create mode 100644 device/centec/arm64-centec_e530_48s4x-r0/platform_components.json create mode 100755 device/centec/arm64-centec_e530_48s4x-r0/platform_reboot create mode 100644 device/centec/arm64-centec_e530_48s4x-r0/plugins/eeprom.py create mode 100644 device/centec/arm64-centec_e530_48s4x-r0/plugins/led_control.py create mode 100644 device/centec/arm64-centec_e530_48s4x-r0/plugins/psuutil.py create mode 100644 device/centec/arm64-centec_e530_48s4x-r0/plugins/sfputil.py create mode 100644 device/centec/arm64-centec_e530_48s4x-r0/pmon_daemon_control.json create mode 100644 device/centec/arm64-centec_e530_48t4x_p-r0/platform_components.json create mode 100755 device/centec/arm64-centec_e530_48t4x_p-r0/platform_reboot create mode 100644 device/centec/arm64-centec_e530_48t4x_p-r0/pmon_daemon_control.json create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/__init__.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/chassis.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/eeprom.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/fan.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/fan_drawer.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/platform.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/psu.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/sfp.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/thermal.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/24x2q/modules/Makefile create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/24x2q/modules/centec_e530_24x2q_platform.c create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/24x2q/service/24x2q_platform.service create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/24x2q/setup.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/__init__.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/chassis.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/eeprom.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/fan.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/fan_drawer.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/platform.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/psu.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/sfp.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/thermal.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/48s4x/modules/Makefile create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/48s4x/modules/centec_e530_48s4x_platform.c create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/48s4x/service/48s4x_platform.service create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/48s4x/setup.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/__init__.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/chassis.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/eeprom.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/fan.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/fan_drawer.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/platform.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/psu.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/sfp.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/thermal.py rename platform/centec-arm64/sonic-platform-modules-e530/{48t4x_p => 48t4x-p}/modules/Makefile (100%) rename platform/centec-arm64/sonic-platform-modules-e530/{48t4x_p => 48t4x-p}/modules/centec_e530_48t4x_p_platform.c (93%) rename platform/centec-arm64/sonic-platform-modules-e530/{48t4x_p => 48t4x-p}/service/48t4x_p_platform.service (100%) rename platform/centec-arm64/sonic-platform-modules-e530/{48t4x_p => 48t4x-p}/setup.py (54%) create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/__init__.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/chassis.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/eeprom.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/fan.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/fan_drawer.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/platform.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/psu.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/sfp.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/thermal.py create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-24x2q.init create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-24x2q.install create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-24x2q.postinst create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-48s4x.init create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-48s4x.install create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-48s4x.postinst create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/fan/Makefile create mode 100644 platform/centec-arm64/sonic-platform-modules-e530/fan/fan-ctc5236.c diff --git a/device/centec/arm64-centec_e530_24x2c-r0/E530-24x2c/port_config.ini b/device/centec/arm64-centec_e530_24x2c-r0/E530-24x2c/port_config.ini index 27d43a0abd0d..454440e10004 100644 --- a/device/centec/arm64-centec_e530_24x2c-r0/E530-24x2c/port_config.ini +++ b/device/centec/arm64-centec_e530_24x2c-r0/E530-24x2c/port_config.ini @@ -1,27 +1,27 @@ -# name lanes alias speed -Ethernet1 0 eth-0-1 10000 -Ethernet2 1 eth-0-2 10000 -Ethernet3 2 eth-0-3 10000 -Ethernet4 3 eth-0-4 10000 -Ethernet5 8 eth-0-5 10000 -Ethernet6 9 eth-0-6 10000 -Ethernet7 10 eth-0-7 10000 -Ethernet8 11 eth-0-8 10000 -Ethernet9 20 eth-0-9 10000 -Ethernet10 21 eth-0-10 10000 -Ethernet11 22 eth-0-11 10000 -Ethernet12 23 eth-0-12 10000 -Ethernet13 12 eth-0-13 10000 -Ethernet14 13 eth-0-14 10000 -Ethernet15 14 eth-0-15 10000 -Ethernet16 15 eth-0-16 10000 -Ethernet17 24 eth-0-17 10000 -Ethernet18 25 eth-0-18 10000 -Ethernet19 26 eth-0-19 10000 -Ethernet20 27 eth-0-20 10000 -Ethernet21 28 eth-0-21 10000 -Ethernet22 29 eth-0-22 10000 -Ethernet23 30 eth-0-23 10000 -Ethernet24 31 eth-0-24 10000 -Ethernet25 61,60,63,62 eth-0-25 100000 -Ethernet26 45,44,47,46 eth-0-26 100000 +# name lanes alias index speed fec +Ethernet0 0 eth-0-1 0 10000 none +Ethernet1 1 eth-0-2 1 10000 none +Ethernet2 2 eth-0-3 2 10000 none +Ethernet3 3 eth-0-4 3 10000 none +Ethernet4 8 eth-0-5 4 10000 none +Ethernet5 9 eth-0-6 5 10000 none +Ethernet6 10 eth-0-7 6 10000 none +Ethernet7 11 eth-0-8 7 10000 none +Ethernet8 20 eth-0-9 8 10000 none +Ethernet9 21 eth-0-10 9 10000 none +Ethernet10 22 eth-0-11 10 10000 none +Ethernet11 23 eth-0-12 11 10000 none +Ethernet12 12 eth-0-13 12 10000 none +Ethernet13 13 eth-0-14 13 10000 none +Ethernet14 14 eth-0-15 14 10000 none +Ethernet15 15 eth-0-16 15 10000 none +Ethernet16 24 eth-0-17 16 10000 none +Ethernet17 25 eth-0-18 17 10000 none +Ethernet18 26 eth-0-19 18 10000 none +Ethernet19 27 eth-0-20 19 10000 none +Ethernet20 28 eth-0-21 20 10000 none +Ethernet21 29 eth-0-22 21 10000 none +Ethernet22 30 eth-0-23 22 10000 none +Ethernet23 31 eth-0-24 23 10000 none +Ethernet24 61,60,63,62 eth-0-25 24 100000 none +Ethernet25 45,44,47,46 eth-0-26 25 100000 none diff --git a/device/centec/arm64-centec_e530_24x2c-r0/fancontrol b/device/centec/arm64-centec_e530_24x2c-r0/fancontrol index e3775297128e..4fbc9cba36ba 100644 --- a/device/centec/arm64-centec_e530_24x2c-r0/fancontrol +++ b/device/centec/arm64-centec_e530_24x2c-r0/fancontrol @@ -1 +1,12 @@ # Configuration file generated by pwmconfig, changes will be lost +INTERVAL=10 +DEVPATH=hwmon1=devices/platform/soc/soc:fan-ctc5236 +DEVNAME=hwmon1=ctc5236fan +FCTEMPS=hwmon1/pwm1=hwmon1/temp1_input hwmon1/pwm2=hwmon1/temp1_input hwmon1/pwm3=hwmon1/temp1_input +FCFANS=hwmon1/pwm1=hwmon1/fan1_input hwmon1/pwm2=hwmon1/fan2_input hwmon1/pwm3=hwmon1/fan3_input +MINTEMP=hwmon1/pwm1=30 hwmon1/pwm2=30 hwmon1/pwm3=30 +MAXTEMP=hwmon1/pwm1=90 hwmon1/pwm2=90 hwmon1/pwm3=90 +MINSTART=hwmon1/pwm1=12 hwmon1/pwm2=12 hwmon1/pwm3=12 +MINSTOP=hwmon1/pwm1=6 hwmon1/pwm2=6 hwmon1/pwm3=6 +MINPWM=hwmon1/pwm1=6 hwmon1/pwm2=6 hwmon1/pwm3=6 +MAXPWM=hwmon1/pwm1=18 hwmon1/pwm2=18 hwmon1/pwm3=18 diff --git a/device/centec/arm64-centec_e530_24x2c-r0/platform_components.json b/device/centec/arm64-centec_e530_24x2c-r0/platform_components.json new file mode 100644 index 000000000000..1e1e968f629f --- /dev/null +++ b/device/centec/arm64-centec_e530_24x2c-r0/platform_components.json @@ -0,0 +1,8 @@ +{ + "chassis": { + "E530-24x2c": { + "component": { + } + } + } +} diff --git a/device/centec/arm64-centec_e530_24x2c-r0/platform_reboot b/device/centec/arm64-centec_e530_24x2c-r0/platform_reboot new file mode 100755 index 000000000000..f22723f98dee --- /dev/null +++ b/device/centec/arm64-centec_e530_24x2c-r0/platform_reboot @@ -0,0 +1,11 @@ +#!/usr/bin/python +import os + +def main(): + # reboot the system + os.system('echo 502 > /sys/class/gpio/export') + os.system('echo out > /sys/class/gpio/gpio502/direction') + os.system('echo 1 > /sys/class/gpio/gpio502/value') + +if __name__ == "__main__": + main() diff --git a/device/centec/arm64-centec_e530_24x2c-r0/plugins/eeprom.py b/device/centec/arm64-centec_e530_24x2c-r0/plugins/eeprom.py index afea818be079..4a7613c40d0e 100644 --- a/device/centec/arm64-centec_e530_24x2c-r0/plugins/eeprom.py +++ b/device/centec/arm64-centec_e530_24x2c-r0/plugins/eeprom.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python + ############################################################################# # Centec E550-24X8Y2C # @@ -10,7 +12,7 @@ try: from sonic_eeprom import eeprom_tlvinfo except ImportError as e: - raise ImportError(str(e) + "- required module not found") + raise ImportError (str(e) + "- required module not found") class board(eeprom_tlvinfo.TlvInfoDecoder): diff --git a/device/centec/arm64-centec_e530_24x2c-r0/plugins/led_control.py b/device/centec/arm64-centec_e530_24x2c-r0/plugins/led_control.py index 627cf03ddad4..13ec67e97d07 100644 --- a/device/centec/arm64-centec_e530_24x2c-r0/plugins/led_control.py +++ b/device/centec/arm64-centec_e530_24x2c-r0/plugins/led_control.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python # # led_control.py # @@ -5,37 +6,110 @@ # try: - from sonic_led.led_control_base import LedControlBase + import os + import re import syslog - from socket import * - from select import * + 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 = { + 0: 1, + 1: 2, + 2: 3, + 3: 4, + 8: 5, + 9: 6, + 10: 7, + 11: 8, + 20: 9, + 21:10, + 22:11, + 23:12, + 12:13, + 13:14, + 14:15, + 15:16, + 24:17, + 25:18, + 26:19, + 27:20, + 28:21, + 29:22, + 30:23, + 31:24, + 61:-1, + 60:25, + 63:-1, + 62:-1, + 45:-1, + 44:26, + 47:-1, + 46:-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, "E530-24x2c", "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): - # Strip "Ethernet" off port name - if not port_name.startswith(self.SONIC_PORT_NAME_PREFIX): - return -1 - - port_idx = int(port_name[len(self.SONIC_PORT_NAME_PREFIX):]) - return port_idx + 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[0] if (port_idx < 25) else self.LED_MODE_UP[1] + return self.LED_MODE_UP[1] if port_idx == 25 or port_idx == 26 else self.LED_MODE_UP[0] else: - return self.LED_MODE_DOWN[0] if (port_idx < 25) else self.LED_MODE_DOWN[1] + return self.LED_MODE_DOWN[1] if port_idx == 25 or port_idx == 26 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: @@ -57,11 +131,15 @@ def _initPanelLed(self): shouldInit = (int(led_file.read()) == 0) if shouldInit == True: - for idx in range(1, 27): - defmode = self._port_state_to_mode(idx, "down") - with open(self.f_led.format("port{}".format(idx)), 'w') as led_file: + 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(idx, defmode)) + DBG_PRINT("init port{} led to mode={}".format(led, defmode)) def _initDefaultConfig(self): DBG_PRINT("start init led") @@ -72,9 +150,10 @@ def _initDefaultConfig(self): 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()) @@ -84,13 +163,3 @@ def port_link_state_change(self, portname, state): self._port_led_mode_update(port_idx, ledMode) DBG_PRINT("update {} led mode from {} to {}".format(portname, saveMode, ledMode)) - - # Constructor - - def __init__(self): - self.SONIC_PORT_NAME_PREFIX = "Ethernet" - self.LED_MODE_UP = [11, 11] - self.LED_MODE_DOWN = [7, 7] - - self.f_led = "/sys/class/leds/{}/brightness" - self._initDefaultConfig() diff --git a/device/centec/arm64-centec_e530_24x2c-r0/plugins/psuutil.py b/device/centec/arm64-centec_e530_24x2c-r0/plugins/psuutil.py index 3a83f406d990..1e83c12c1131 100644 --- a/device/centec/arm64-centec_e530_24x2c-r0/plugins/psuutil.py +++ b/device/centec/arm64-centec_e530_24x2c-r0/plugins/psuutil.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python + ############################################################################# # Centec # @@ -9,8 +11,7 @@ try: from sonic_psu.psu_base import PsuBase except ImportError as e: - raise ImportError(str(e) + "- required module not found") - + raise ImportError (str(e) + "- required module not found") class PsuUtil(PsuBase): """Platform-specific PSUutil class""" diff --git a/device/centec/arm64-centec_e530_24x2c-r0/plugins/sfputil.py b/device/centec/arm64-centec_e530_24x2c-r0/plugins/sfputil.py index c5c0dc8e16e0..3ae79108cffe 100644 --- a/device/centec/arm64-centec_e530_24x2c-r0/plugins/sfputil.py +++ b/device/centec/arm64-centec_e530_24x2c-r0/plugins/sfputil.py @@ -1,28 +1,117 @@ +#!/usr/bin/env python + # sfputil.py # # Platform-specific SFP transceiver interface for SONiC # try: + import os + import re import time - from socket import * - from select import * + 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)) - -def DBG_PRINT(str): - print(str + "\n") - - 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 = { + 0: 1, + 1: 2, + 2: 3, + 3: 4, + 8: 5, + 9: 6, + 10: 7, + 11: 8, + 20: 9, + 21:10, + 22:11, + 23:12, + 12:13, + 13:14, + 14:15, + 15:16, + 24:17, + 25:18, + 26:19, + 27:20, + 28:21, + 29:22, + 30:23, + 31:24, + 61:25, + 60:25, + 63:25, + 62:25, + 45:26, + 44:26, + 47:26, + 46:26, + } + 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, "E530-24x2c", "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 @@ -33,11 +122,20 @@ def port_end(self): @property def sfp_base(self): - return self.SFP_BASE + return self.PORT_START @property def qsfp_ports(self): - return list(range(25, self.PORTS_IN_BLOCK + 1)) + 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 == 25 or sfp_idx == 26: + 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): @@ -46,93 +144,32 @@ def port_to_eeprom_mapping(self): def is_logical_port(self, port_name): return True - def get_eeprom_data(self, port): - ret = None - port_num = self.get_logical_to_physical(port)[0] - if port_num < self.port_start or port_num > self.port_end: - return ret - if port_num < self.sfp_base: - return ret - try: - with open(self.eeprom_mapping[port_num], 'r') as eeprom_file: - ret = eeprom_file.read() - except IOError as e: - DBG_PRINT(str(e)) - - return ret - - # todo - # def _get_port_eeprom_path(self, port_num, devid): - # pass - - def __init__(self): - self.SONIC_PORT_NAME_PREFIX = "Ethernet" - self.PORT_START = 1 - self.PORT_END = 26 - self.SFP_BASE = 1 - self.PORTS_IN_BLOCK = 26 - self.logical = [] - self.physical_to_logical = {} - self.logical_to_physical = {} - - self.eeprom_mapping = {} - self.f_sfp_present = "/sys/class/sfp/sfp{}/sfp_presence" - self.f_sfp_enable = "/sys/class/sfp/sfp{}/sfp_enable" - for x in range(self.port_start, self.sfp_base): - self.eeprom_mapping[x] = None - for x in range(self.sfp_base, self.port_end + 1): - self.eeprom_mapping[x] = "/sys/class/sfp/sfp{}/sfp_eeprom".format( - x - self.sfp_base + 1) - self.presence = {} - for x in range(self.sfp_base, self.port_end + 1): - self.presence[x] = False - - SfpUtilBase.__init__(self) - - for x in range(self.sfp_base, self.port_end + 1): - self.logical.append('Ethernet' + str(x)) - 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 < self.sfp_base: - return False - try: - with open(self.f_sfp_present.format(port_num - self.sfp_base + 1), 'r') as sfp_file: - return 1 == int(sfp_file.read()) - except IOError as e: - DBG_PRINT(str(e)) - + 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): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: - return False - return False 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 False 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 False - def read_porttab_mappings(self, porttabfile): - for x in range(self.sfp_base, self.port_end + 1): - self.logical_to_physical['Ethernet' + str(x)] = [x] - self.physical_to_logical[x] = ['Ethernet' + str(x)] - - data = {'valid': 0, 'last': 0} + 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() @@ -140,19 +177,19 @@ def get_transceiver_change_event(self, timeout=2000): if timeout < 1000: timeout = 1000 - timeout = (timeout) / float(1000) # Convert to secs + timeout = (timeout) / float(1000) # Convert to secs if now < (self.data['last'] + timeout) and self.data['valid']: return True, {} - for x in range(self.sfp_base, self.port_end + 1): - presence = self.get_presence(x) - if presence != self.presence[x]: - self.presence[x] = presence + 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[x] = SFP_STATUS_INSERTED + port_dict[int(port_cfg.index)] = SFP_STATUS_INSERTED else: - port_dict[x] = SFP_STATUS_REMOVED + port_dict[int(port_cfg.index)] = SFP_STATUS_REMOVED if bool(port_dict): self.data['last'] = now diff --git a/device/centec/arm64-centec_e530_24x2c-r0/pmon_daemon_control.json b/device/centec/arm64-centec_e530_24x2c-r0/pmon_daemon_control.json new file mode 100644 index 000000000000..0db3279e44b0 --- /dev/null +++ b/device/centec/arm64-centec_e530_24x2c-r0/pmon_daemon_control.json @@ -0,0 +1,3 @@ +{ + +} diff --git a/device/centec/arm64-centec_e530_24x2q-r0/E530-24x2q/buffers.json.j2 b/device/centec/arm64-centec_e530_24x2q-r0/E530-24x2q/buffers.json.j2 new file mode 100644 index 000000000000..08e21e428b6c --- /dev/null +++ b/device/centec/arm64-centec_e530_24x2q-r0/E530-24x2q/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/arm64-centec_e530_24x2q-r0/E530-24x2q/pg_profile_lookup.ini b/device/centec/arm64-centec_e530_24x2q-r0/E530-24x2q/pg_profile_lookup.ini new file mode 100644 index 000000000000..a65244e69b5b --- /dev/null +++ b/device/centec/arm64-centec_e530_24x2q-r0/E530-24x2q/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/arm64-centec_e530_24x2q-r0/E530-24x2q/port_config.ini b/device/centec/arm64-centec_e530_24x2q-r0/E530-24x2q/port_config.ini new file mode 100644 index 000000000000..19847734ef13 --- /dev/null +++ b/device/centec/arm64-centec_e530_24x2q-r0/E530-24x2q/port_config.ini @@ -0,0 +1,27 @@ +# name lanes alias index speed fec +Ethernet0 0 eth-0-1 0 10000 none +Ethernet1 1 eth-0-2 1 10000 none +Ethernet2 2 eth-0-3 2 10000 none +Ethernet3 3 eth-0-4 3 10000 none +Ethernet4 8 eth-0-5 4 10000 none +Ethernet5 9 eth-0-6 5 10000 none +Ethernet6 10 eth-0-7 6 10000 none +Ethernet7 11 eth-0-8 7 10000 none +Ethernet8 20 eth-0-9 8 10000 none +Ethernet9 21 eth-0-10 9 10000 none +Ethernet10 22 eth-0-11 10 10000 none +Ethernet11 23 eth-0-12 11 10000 none +Ethernet12 12 eth-0-13 12 10000 none +Ethernet13 13 eth-0-14 13 10000 none +Ethernet14 14 eth-0-15 14 10000 none +Ethernet15 15 eth-0-16 15 10000 none +Ethernet16 24 eth-0-17 16 10000 none +Ethernet17 25 eth-0-18 17 10000 none +Ethernet18 26 eth-0-19 18 10000 none +Ethernet19 27 eth-0-20 19 10000 none +Ethernet20 28 eth-0-21 20 10000 none +Ethernet21 29 eth-0-22 21 10000 none +Ethernet22 30 eth-0-23 22 10000 none +Ethernet23 31 eth-0-24 23 10000 none +Ethernet24 61,60,63,62 eth-0-25 24 40000 none +Ethernet25 45,44,47,46 eth-0-26 25 40000 none diff --git a/device/centec/arm64-centec_e530_24x2q-r0/E530-24x2q/qos.json.j2 b/device/centec/arm64-centec_e530_24x2q-r0/E530-24x2q/qos.json.j2 new file mode 100644 index 000000000000..3e548325ea30 --- /dev/null +++ b/device/centec/arm64-centec_e530_24x2q-r0/E530-24x2q/qos.json.j2 @@ -0,0 +1 @@ +{%- include 'qos_config.j2' %} diff --git a/device/centec/arm64-centec_e530_24x2q-r0/E530-24x2q/sai.profile b/device/centec/arm64-centec_e530_24x2q-r0/E530-24x2q/sai.profile new file mode 100644 index 000000000000..7dc47bf34c23 --- /dev/null +++ b/device/centec/arm64-centec_e530_24x2q-r0/E530-24x2q/sai.profile @@ -0,0 +1,2 @@ +SAI_INIT_CONFIG_FILE=/etc/centec/E530-24x2q-chip-profile.txt +SAI_HW_PORT_PROFILE_ID_CONFIG_FILE=/etc/centec/E530-24x2q-datapath-cfg.txt diff --git a/device/centec/arm64-centec_e530_24x2q-r0/default_sku b/device/centec/arm64-centec_e530_24x2q-r0/default_sku new file mode 100644 index 000000000000..bbf54fb95e4c --- /dev/null +++ b/device/centec/arm64-centec_e530_24x2q-r0/default_sku @@ -0,0 +1 @@ +E530-24x2q l2 diff --git a/device/centec/arm64-centec_e530_24x2q-r0/fancontrol b/device/centec/arm64-centec_e530_24x2q-r0/fancontrol new file mode 100644 index 000000000000..4fbc9cba36ba --- /dev/null +++ b/device/centec/arm64-centec_e530_24x2q-r0/fancontrol @@ -0,0 +1,12 @@ +# Configuration file generated by pwmconfig, changes will be lost +INTERVAL=10 +DEVPATH=hwmon1=devices/platform/soc/soc:fan-ctc5236 +DEVNAME=hwmon1=ctc5236fan +FCTEMPS=hwmon1/pwm1=hwmon1/temp1_input hwmon1/pwm2=hwmon1/temp1_input hwmon1/pwm3=hwmon1/temp1_input +FCFANS=hwmon1/pwm1=hwmon1/fan1_input hwmon1/pwm2=hwmon1/fan2_input hwmon1/pwm3=hwmon1/fan3_input +MINTEMP=hwmon1/pwm1=30 hwmon1/pwm2=30 hwmon1/pwm3=30 +MAXTEMP=hwmon1/pwm1=90 hwmon1/pwm2=90 hwmon1/pwm3=90 +MINSTART=hwmon1/pwm1=12 hwmon1/pwm2=12 hwmon1/pwm3=12 +MINSTOP=hwmon1/pwm1=6 hwmon1/pwm2=6 hwmon1/pwm3=6 +MINPWM=hwmon1/pwm1=6 hwmon1/pwm2=6 hwmon1/pwm3=6 +MAXPWM=hwmon1/pwm1=18 hwmon1/pwm2=18 hwmon1/pwm3=18 diff --git a/platform/centec-arm64/sonic-platform-modules-e530/24x2c/classes/__init__.py b/device/centec/arm64-centec_e530_24x2q-r0/installer.conf similarity index 100% rename from platform/centec-arm64/sonic-platform-modules-e530/24x2c/classes/__init__.py rename to device/centec/arm64-centec_e530_24x2q-r0/installer.conf diff --git a/device/centec/arm64-centec_e530_24x2q-r0/platform_components.json b/device/centec/arm64-centec_e530_24x2q-r0/platform_components.json new file mode 100644 index 000000000000..a9fe4fd4e82d --- /dev/null +++ b/device/centec/arm64-centec_e530_24x2q-r0/platform_components.json @@ -0,0 +1,8 @@ +{ + "chassis": { + "E530-24x2q": { + "component": { + } + } + } +} diff --git a/device/centec/arm64-centec_e530_24x2q-r0/platform_reboot b/device/centec/arm64-centec_e530_24x2q-r0/platform_reboot new file mode 100755 index 000000000000..f22723f98dee --- /dev/null +++ b/device/centec/arm64-centec_e530_24x2q-r0/platform_reboot @@ -0,0 +1,11 @@ +#!/usr/bin/python +import os + +def main(): + # reboot the system + os.system('echo 502 > /sys/class/gpio/export') + os.system('echo out > /sys/class/gpio/gpio502/direction') + os.system('echo 1 > /sys/class/gpio/gpio502/value') + +if __name__ == "__main__": + main() diff --git a/device/centec/arm64-centec_e530_24x2q-r0/plugins/eeprom.py b/device/centec/arm64-centec_e530_24x2q-r0/plugins/eeprom.py new file mode 100644 index 000000000000..4a7613c40d0e --- /dev/null +++ b/device/centec/arm64-centec_e530_24x2q-r0/plugins/eeprom.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +############################################################################# +# Centec E550-24X8Y2C +# +# 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: + 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 = "/dev/mtd3" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/centec/arm64-centec_e530_24x2q-r0/plugins/led_control.py b/device/centec/arm64-centec_e530_24x2q-r0/plugins/led_control.py new file mode 100644 index 000000000000..e1ea93952d03 --- /dev/null +++ b/device/centec/arm64-centec_e530_24x2q-r0/plugins/led_control.py @@ -0,0 +1,165 @@ +#!/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 = { + 0: 1, + 1: 2, + 2: 3, + 3: 4, + 8: 5, + 9: 6, + 10: 7, + 11: 8, + 20: 9, + 21:10, + 22:11, + 23:12, + 12:13, + 13:14, + 14:15, + 15:16, + 24:17, + 25:18, + 26:19, + 27:20, + 28:21, + 29:22, + 30:23, + 31:24, + 61:-1, + 60:25, + 63:-1, + 62:-1, + 45:-1, + 44:26, + 47:-1, + 46:-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, "E530-24x2q", "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 == 25 or port_idx == 26 else self.LED_MODE_UP[0] + else: + return self.LED_MODE_DOWN[1] if port_idx == 25 or port_idx == 26 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/arm64-centec_e530_24x2q-r0/plugins/psuutil.py b/device/centec/arm64-centec_e530_24x2q-r0/plugins/psuutil.py new file mode 100644 index 000000000000..1e83c12c1131 --- /dev/null +++ b/device/centec/arm64-centec_e530_24x2q-r0/plugins/psuutil.py @@ -0,0 +1,72 @@ +#!/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 +# +############################################################################# + +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) + + self.psu_path = "/sys/class/psu/psu{}/" + self.psu_presence = "psu_presence" + self.psu_oper_status = "psu_status" + + 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 + + status = 0 + try: + with open(self.psu_path.format(index) + self.psu_oper_status, 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 1 + + 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 + + status = 0 + try: + with open(self.psu_path.format(index) + self.psu_presence, 'r') as presence_status: + status = int(presence_status.read()) + except IOError: + return False + + return status == 1 diff --git a/device/centec/arm64-centec_e530_24x2q-r0/plugins/sfputil.py b/device/centec/arm64-centec_e530_24x2q-r0/plugins/sfputil.py new file mode 100644 index 000000000000..ac5a937e7526 --- /dev/null +++ b/device/centec/arm64-centec_e530_24x2q-r0/plugins/sfputil.py @@ -0,0 +1,200 @@ +#!/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 = { + 0: 1, + 1: 2, + 2: 3, + 3: 4, + 8: 5, + 9: 6, + 10: 7, + 11: 8, + 20: 9, + 21:10, + 22:11, + 23:12, + 12:13, + 13:14, + 14:15, + 15:16, + 24:17, + 25:18, + 26:19, + 27:20, + 28:21, + 29:22, + 30:23, + 31:24, + 61:25, + 60:25, + 63:25, + 62:25, + 45:26, + 44:26, + 47:26, + 46:26, + } + 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, "E530-24x2q", "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 == 25 or sfp_idx == 26: + 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/arm64-centec_e530_24x2q-r0/pmon_daemon_control.json b/device/centec/arm64-centec_e530_24x2q-r0/pmon_daemon_control.json new file mode 100644 index 000000000000..0db3279e44b0 --- /dev/null +++ b/device/centec/arm64-centec_e530_24x2q-r0/pmon_daemon_control.json @@ -0,0 +1,3 @@ +{ + +} diff --git a/device/centec/arm64-centec_e530_48s4x-r0/E530-48s4x/buffers.json.j2 b/device/centec/arm64-centec_e530_48s4x-r0/E530-48s4x/buffers.json.j2 new file mode 100644 index 000000000000..08e21e428b6c --- /dev/null +++ b/device/centec/arm64-centec_e530_48s4x-r0/E530-48s4x/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/arm64-centec_e530_48s4x-r0/E530-48s4x/pg_profile_lookup.ini b/device/centec/arm64-centec_e530_48s4x-r0/E530-48s4x/pg_profile_lookup.ini new file mode 100644 index 000000000000..a65244e69b5b --- /dev/null +++ b/device/centec/arm64-centec_e530_48s4x-r0/E530-48s4x/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/arm64-centec_e530_48s4x-r0/E530-48s4x/port_config.ini b/device/centec/arm64-centec_e530_48s4x-r0/E530-48s4x/port_config.ini new file mode 100644 index 000000000000..d83d20e8139e --- /dev/null +++ b/device/centec/arm64-centec_e530_48s4x-r0/E530-48s4x/port_config.ini @@ -0,0 +1,53 @@ +# name lanes alias index speed fec +Ethernet0 0 eth-0-1 0 1000 none +Ethernet1 1 eth-0-2 1 1000 none +Ethernet2 2 eth-0-3 2 1000 none +Ethernet3 3 eth-0-4 3 1000 none +Ethernet4 4 eth-0-5 4 1000 none +Ethernet5 5 eth-0-6 5 1000 none +Ethernet6 6 eth-0-7 6 1000 none +Ethernet7 7 eth-0-8 7 1000 none +Ethernet8 16 eth-0-9 8 1000 none +Ethernet9 17 eth-0-10 9 1000 none +Ethernet10 18 eth-0-11 10 1000 none +Ethernet11 19 eth-0-12 11 1000 none +Ethernet12 20 eth-0-13 12 1000 none +Ethernet13 21 eth-0-14 13 1000 none +Ethernet14 22 eth-0-15 14 1000 none +Ethernet15 23 eth-0-16 15 1000 none +Ethernet16 8 eth-0-17 16 1000 none +Ethernet17 9 eth-0-18 17 1000 none +Ethernet18 10 eth-0-19 18 1000 none +Ethernet19 11 eth-0-20 19 1000 none +Ethernet20 32 eth-0-21 20 1000 none +Ethernet21 33 eth-0-22 21 1000 none +Ethernet22 34 eth-0-23 22 1000 none +Ethernet23 35 eth-0-24 23 1000 none +Ethernet24 36 eth-0-25 24 1000 none +Ethernet25 37 eth-0-26 25 1000 none +Ethernet26 38 eth-0-27 26 1000 none +Ethernet27 39 eth-0-28 27 1000 none +Ethernet28 40 eth-0-29 28 1000 none +Ethernet29 41 eth-0-30 29 1000 none +Ethernet30 42 eth-0-31 30 1000 none +Ethernet31 43 eth-0-32 31 1000 none +Ethernet32 25 eth-0-33 32 1000 none +Ethernet33 24 eth-0-34 33 1000 none +Ethernet34 27 eth-0-35 34 1000 none +Ethernet35 26 eth-0-36 35 1000 none +Ethernet36 13 eth-0-37 36 1000 none +Ethernet37 12 eth-0-38 37 1000 none +Ethernet38 15 eth-0-39 38 1000 none +Ethernet39 14 eth-0-40 39 1000 none +Ethernet40 29 eth-0-41 40 1000 none +Ethernet41 28 eth-0-42 41 1000 none +Ethernet42 31 eth-0-43 42 1000 none +Ethernet43 30 eth-0-44 43 1000 none +Ethernet44 61 eth-0-45 44 1000 none +Ethernet45 60 eth-0-46 45 1000 none +Ethernet46 63 eth-0-47 46 1000 none +Ethernet47 62 eth-0-48 47 1000 none +Ethernet48 44 eth-0-49 48 10000 none +Ethernet49 45 eth-0-50 49 10000 none +Ethernet50 47 eth-0-51 50 10000 none +Ethernet51 46 eth-0-52 51 10000 none diff --git a/device/centec/arm64-centec_e530_48s4x-r0/E530-48s4x/qos.json.j2 b/device/centec/arm64-centec_e530_48s4x-r0/E530-48s4x/qos.json.j2 new file mode 100644 index 000000000000..3e548325ea30 --- /dev/null +++ b/device/centec/arm64-centec_e530_48s4x-r0/E530-48s4x/qos.json.j2 @@ -0,0 +1 @@ +{%- include 'qos_config.j2' %} diff --git a/device/centec/arm64-centec_e530_48s4x-r0/E530-48s4x/sai.profile b/device/centec/arm64-centec_e530_48s4x-r0/E530-48s4x/sai.profile new file mode 100644 index 000000000000..306e071e51c3 --- /dev/null +++ b/device/centec/arm64-centec_e530_48s4x-r0/E530-48s4x/sai.profile @@ -0,0 +1,2 @@ +SAI_INIT_CONFIG_FILE=/etc/centec/E530-48s4x-chip-profile.txt +SAI_HW_PORT_PROFILE_ID_CONFIG_FILE=/etc/centec/E530-48s4x-datapath.txt diff --git a/device/centec/arm64-centec_e530_48s4x-r0/default_sku b/device/centec/arm64-centec_e530_48s4x-r0/default_sku new file mode 100644 index 000000000000..08098071dc38 --- /dev/null +++ b/device/centec/arm64-centec_e530_48s4x-r0/default_sku @@ -0,0 +1 @@ +E530-48s4x l2 diff --git a/device/centec/arm64-centec_e530_48s4x-r0/fancontrol b/device/centec/arm64-centec_e530_48s4x-r0/fancontrol new file mode 100644 index 000000000000..cf8acbdecb7b --- /dev/null +++ b/device/centec/arm64-centec_e530_48s4x-r0/fancontrol @@ -0,0 +1,12 @@ +# Configuration file generated by pwmconfig, changes will be lost +INTERVAL=10 +DEVPATH=hwmon1=devices/platform/soc/soc:fan-ctc5236 +DEVNAME=hwmon1=ctc5236fan +FCTEMPS=hwmon1/pwm1=hwmon1/temp1_input hwmon1/pwm2=hwmon1/temp1_input hwmon1/pwm3=hwmon1/temp1_input hwmon1/pwm4=hwmon1/temp1_input +FCFANS=hwmon1/pwm1=hwmon1/fan1_input hwmon1/pwm2=hwmon1/fan2_input hwmon1/pwm3=hwmon1/fan3_input hwmon1/pwm4=hwmon1/fan4_input +MINTEMP=hwmon1/pwm1=30 hwmon1/pwm2=30 hwmon1/pwm3=30 hwmon1/pwm4=30 +MAXTEMP=hwmon1/pwm1=90 hwmon1/pwm2=90 hwmon1/pwm3=90 hwmon1/pwm4=90 +MINSTART=hwmon1/pwm1=12 hwmon1/pwm2=12 hwmon1/pwm3=12 hwmon1/pwm4=12 +MINSTOP=hwmon1/pwm1=6 hwmon1/pwm2=6 hwmon1/pwm3=6 hwmon1/pwm4=6 +MINPWM=hwmon1/pwm1=6 hwmon1/pwm2=6 hwmon1/pwm3=6 hwmon1/pwm4=6 +MAXPWM=hwmon1/pwm1=18 hwmon1/pwm2=18 hwmon1/pwm3=18 hwmon1/pwm4=18 diff --git a/platform/centec-arm64/sonic-platform-modules-e530/48t4x_p/classes/__init__.py b/device/centec/arm64-centec_e530_48s4x-r0/installer.conf similarity index 100% rename from platform/centec-arm64/sonic-platform-modules-e530/48t4x_p/classes/__init__.py rename to device/centec/arm64-centec_e530_48s4x-r0/installer.conf diff --git a/device/centec/arm64-centec_e530_48s4x-r0/platform_components.json b/device/centec/arm64-centec_e530_48s4x-r0/platform_components.json new file mode 100644 index 000000000000..3649f3c14d45 --- /dev/null +++ b/device/centec/arm64-centec_e530_48s4x-r0/platform_components.json @@ -0,0 +1,8 @@ +{ + "chassis": { + "E530-48s4x": { + "component": { + } + } + } +} diff --git a/device/centec/arm64-centec_e530_48s4x-r0/platform_reboot b/device/centec/arm64-centec_e530_48s4x-r0/platform_reboot new file mode 100755 index 000000000000..98f62ca16ccf --- /dev/null +++ b/device/centec/arm64-centec_e530_48s4x-r0/platform_reboot @@ -0,0 +1,12 @@ +#!/usr/bin/python +import os + +def main(): + # reboot the system + os.system('modprobe i2c-dev') + os.system('i2cset -y 0 0x36 0x23 0x0') + os.system('sleep 1') + os.system('i2cset -y 0 0x36 0x23 0x3') + +if __name__ == "__main__": + main() diff --git a/device/centec/arm64-centec_e530_48s4x-r0/plugins/eeprom.py b/device/centec/arm64-centec_e530_48s4x-r0/plugins/eeprom.py new file mode 100644 index 000000000000..173c34ed56d2 --- /dev/null +++ b/device/centec/arm64-centec_e530_48s4x-r0/plugins/eeprom.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +############################################################################# +# Centec E530-48S4X +# +# 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: + 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 = "/dev/mtd3" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/centec/arm64-centec_e530_48s4x-r0/plugins/led_control.py b/device/centec/arm64-centec_e530_48s4x-r0/plugins/led_control.py new file mode 100644 index 000000000000..2820df84dbd8 --- /dev/null +++ b/device/centec/arm64-centec_e530_48s4x-r0/plugins/led_control.py @@ -0,0 +1,98 @@ +#!/usr/bin/env python +# +# led_control.py +# +# Platform-specific LED control functionality for SONiC +# + +try: + from sonic_led.led_control_base import LedControlBase + import syslog + from socket import * + from select import * +except ImportError as e: + raise ImportError(str(e) + " - required module not found") + + +def DBG_PRINT(str): + syslog.openlog("centec-led") + syslog.syslog(syslog.LOG_INFO, str) + syslog.closelog() + + +class LedControl(LedControlBase): + """Platform specific LED control class""" + + + # Helper method to map SONiC port name to index + def _port_name_to_index(self, port_name): + # Strip "Ethernet" off port name + if not port_name.startswith(self.SONIC_PORT_NAME_PREFIX): + return -1 + + port_idx = int(port_name[len(self.SONIC_PORT_NAME_PREFIX):]) + return port_idx + 1 + + def _port_state_to_mode(self, port_idx, state): + if state == "up": + return self.LED_MODE_UP[0] if (port_idx < 49) else self.LED_MODE_UP[1] + else: + return self.LED_MODE_DOWN[0] if (port_idx < 49) else self.LED_MODE_DOWN[1] + + 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("3") + 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 idx in range(1, 53): + defmode = self._port_state_to_mode(idx, "down") + with open(self.f_led.format("port{}".format(idx)), 'w') as led_file: + led_file.write(str(defmode)) + DBG_PRINT("init port{} led to mode={}".format(idx, 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) + 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)) + + + # Constructor + def __init__(self): + self.SONIC_PORT_NAME_PREFIX = "Ethernet" + self.LED_MODE_UP = [5, 6] + self.LED_MODE_DOWN = [7, 7] + + self.f_led = "/sys/class/leds/{}/brightness" + self._initDefaultConfig() diff --git a/device/centec/arm64-centec_e530_48s4x-r0/plugins/psuutil.py b/device/centec/arm64-centec_e530_48s4x-r0/plugins/psuutil.py new file mode 100644 index 000000000000..1e83c12c1131 --- /dev/null +++ b/device/centec/arm64-centec_e530_48s4x-r0/plugins/psuutil.py @@ -0,0 +1,72 @@ +#!/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 +# +############################################################################# + +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) + + self.psu_path = "/sys/class/psu/psu{}/" + self.psu_presence = "psu_presence" + self.psu_oper_status = "psu_status" + + 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 + + status = 0 + try: + with open(self.psu_path.format(index) + self.psu_oper_status, 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 1 + + 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 + + status = 0 + try: + with open(self.psu_path.format(index) + self.psu_presence, 'r') as presence_status: + status = int(presence_status.read()) + except IOError: + return False + + return status == 1 diff --git a/device/centec/arm64-centec_e530_48s4x-r0/plugins/sfputil.py b/device/centec/arm64-centec_e530_48s4x-r0/plugins/sfputil.py new file mode 100644 index 000000000000..9e44afb8f094 --- /dev/null +++ b/device/centec/arm64-centec_e530_48s4x-r0/plugins/sfputil.py @@ -0,0 +1,161 @@ +#!/usr/bin/env python + +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# + +try: + import time + from socket import * + from select import * + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +def DBG_PRINT(str): + print(str + "\n") + +SFP_STATUS_INSERTED = '1' +SFP_STATUS_REMOVED = '0' + +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" + + @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.SFP_BASE + + @property + def qsfp_ports(self): + return () + + @property + def port_to_eeprom_mapping(self): + return self.eeprom_mapping + + def is_logical_port(self, port_name): + return True + + def get_eeprom_data(self, port): + ret = None + port_num = self.get_logical_to_physical(port)[0] + 1 + if port_num < self.port_start or port_num > self.port_end: + return ret + if port_num < self.sfp_base: + return ret + try: + with open(self.eeprom_mapping[port_num], 'r') as eeprom_file: + ret = eeprom_file.read() + except IOError as e: + DBG_PRINT(str(e)) + + return ret + + def __init__(self): + self.SONIC_PORT_NAME_PREFIX = "Ethernet" + self.PORT_START = 0 + self.PORT_END = 51 + self.SFP_BASE = 0 + self.PORTS_IN_BLOCK = 52 + self.logical = [] + self.physical_to_logical = {} + self.logical_to_physical = {} + self.logical_to_asic = {} + self.data = {'valid':0, 'last':0} + + self.eeprom_mapping = {} + self.f_sfp_present = "/sys/class/sfp/sfp{}/sfp_presence" + self.f_sfp_enable = "/sys/class/sfp/sfp{}/sfp_enable" + for x in range(self.port_start, self.sfp_base): + self.eeprom_mapping[x] = None + for x in range(self.sfp_base, self.port_end + 1): + self.eeprom_mapping[x] = "/sys/class/sfp/sfp{}/sfp_eeprom".format(x - self.sfp_base + 1) + self.presence = {} + for x in range(self.sfp_base, self.port_end + 1): + self.presence[x] = False; + + SfpUtilBase.__init__(self) + + for x in range(self.sfp_base, self.port_end + 1): + self.logical.append('Ethernet' + str(x)) + + 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 < self.sfp_base: + return False + try: + with open(self.f_sfp_present.format(port_num - self.sfp_base + 1), '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): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + return False + + 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 False + + 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 False + + + def read_porttab_mappings(self, porttabfile, asic_inst = 0): + for x in range(self.sfp_base, self.port_end + 1): + self.logical_to_physical['Ethernet' + str(x)] = [x] + self.logical_to_asic['Ethernet' + str(x)] = 0 + self.physical_to_logical[x] = ['Ethernet' + str(x)] + + 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 x in range(self.sfp_base, self.port_end + 1): + presence = self.get_presence(x) + if presence != self.presence[x]: + self.presence[x] = presence + # index in port_config.ini + if presence: + port_dict[x] = SFP_STATUS_INSERTED + else: + port_dict[x] = 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/arm64-centec_e530_48s4x-r0/pmon_daemon_control.json b/device/centec/arm64-centec_e530_48s4x-r0/pmon_daemon_control.json new file mode 100644 index 000000000000..0db3279e44b0 --- /dev/null +++ b/device/centec/arm64-centec_e530_48s4x-r0/pmon_daemon_control.json @@ -0,0 +1,3 @@ +{ + +} diff --git a/device/centec/arm64-centec_e530_48t4x_p-r0/E530-48t4x-p/port_config.ini b/device/centec/arm64-centec_e530_48t4x_p-r0/E530-48t4x-p/port_config.ini index c904ece72ea0..928267bee60d 100644 --- a/device/centec/arm64-centec_e530_48t4x_p-r0/E530-48t4x-p/port_config.ini +++ b/device/centec/arm64-centec_e530_48t4x_p-r0/E530-48t4x-p/port_config.ini @@ -1,53 +1,53 @@ -# name lanes alias speed -Ethernet1 1 eth-0-1 1000 -Ethernet2 0 eth-0-2 1000 -Ethernet3 3 eth-0-3 1000 -Ethernet4 2 eth-0-4 1000 -Ethernet5 5 eth-0-5 1000 -Ethernet6 4 eth-0-6 1000 -Ethernet7 7 eth-0-7 1000 -Ethernet8 6 eth-0-8 1000 -Ethernet9 17 eth-0-9 1000 -Ethernet10 16 eth-0-10 1000 -Ethernet11 19 eth-0-11 1000 -Ethernet12 18 eth-0-12 1000 -Ethernet13 21 eth-0-13 1000 -Ethernet14 20 eth-0-14 1000 -Ethernet15 23 eth-0-15 1000 -Ethernet16 22 eth-0-16 1000 -Ethernet17 9 eth-0-17 1000 -Ethernet18 8 eth-0-18 1000 -Ethernet19 11 eth-0-19 1000 -Ethernet20 10 eth-0-20 1000 -Ethernet21 33 eth-0-21 1000 -Ethernet22 32 eth-0-22 1000 -Ethernet23 35 eth-0-23 1000 -Ethernet24 34 eth-0-24 1000 -Ethernet25 37 eth-0-25 1000 -Ethernet26 36 eth-0-26 1000 -Ethernet27 39 eth-0-27 1000 -Ethernet28 38 eth-0-28 1000 -Ethernet29 41 eth-0-29 1000 -Ethernet30 40 eth-0-30 1000 -Ethernet31 43 eth-0-31 1000 -Ethernet32 42 eth-0-32 1000 -Ethernet33 25 eth-0-33 1000 -Ethernet34 24 eth-0-34 1000 -Ethernet35 27 eth-0-35 1000 -Ethernet36 26 eth-0-36 1000 -Ethernet37 49 eth-0-37 1000 -Ethernet38 48 eth-0-38 1000 -Ethernet39 51 eth-0-39 1000 -Ethernet40 50 eth-0-40 1000 -Ethernet41 53 eth-0-41 1000 -Ethernet42 52 eth-0-42 1000 -Ethernet43 55 eth-0-43 1000 -Ethernet44 54 eth-0-44 1000 -Ethernet45 57 eth-0-45 1000 -Ethernet46 56 eth-0-46 1000 -Ethernet47 59 eth-0-47 1000 -Ethernet48 58 eth-0-48 1000 -Ethernet49 13 eth-0-49 10000 -Ethernet50 12 eth-0-50 10000 -Ethernet51 15 eth-0-51 10000 -Ethernet52 14 eth-0-52 10000 +# name lanes alias index speed fec +Ethernet0 1 eth-0-1 0 1000 none +Ethernet1 0 eth-0-2 1 1000 none +Ethernet2 3 eth-0-3 2 1000 none +Ethernet3 2 eth-0-4 3 1000 none +Ethernet4 5 eth-0-5 4 1000 none +Ethernet5 4 eth-0-6 5 1000 none +Ethernet6 7 eth-0-7 6 1000 none +Ethernet7 6 eth-0-8 7 1000 none +Ethernet8 17 eth-0-9 8 1000 none +Ethernet9 16 eth-0-10 9 1000 none +Ethernet10 19 eth-0-11 10 1000 none +Ethernet11 18 eth-0-12 11 1000 none +Ethernet12 21 eth-0-13 12 1000 none +Ethernet13 20 eth-0-14 13 1000 none +Ethernet14 23 eth-0-15 14 1000 none +Ethernet15 22 eth-0-16 15 1000 none +Ethernet16 9 eth-0-17 16 1000 none +Ethernet17 8 eth-0-18 17 1000 none +Ethernet18 11 eth-0-19 18 1000 none +Ethernet19 10 eth-0-20 19 1000 none +Ethernet20 33 eth-0-21 20 1000 none +Ethernet21 32 eth-0-22 21 1000 none +Ethernet22 35 eth-0-23 22 1000 none +Ethernet23 34 eth-0-24 23 1000 none +Ethernet24 37 eth-0-25 24 1000 none +Ethernet25 36 eth-0-26 25 1000 none +Ethernet26 39 eth-0-27 26 1000 none +Ethernet27 38 eth-0-28 27 1000 none +Ethernet28 41 eth-0-29 28 1000 none +Ethernet29 40 eth-0-30 29 1000 none +Ethernet30 43 eth-0-31 30 1000 none +Ethernet31 42 eth-0-32 31 1000 none +Ethernet32 25 eth-0-33 32 1000 none +Ethernet33 24 eth-0-34 33 1000 none +Ethernet34 27 eth-0-35 34 1000 none +Ethernet35 26 eth-0-36 35 1000 none +Ethernet36 49 eth-0-37 36 1000 none +Ethernet37 48 eth-0-38 37 1000 none +Ethernet38 51 eth-0-39 38 1000 none +Ethernet39 50 eth-0-40 39 1000 none +Ethernet40 53 eth-0-41 40 1000 none +Ethernet41 52 eth-0-42 41 1000 none +Ethernet42 55 eth-0-43 42 1000 none +Ethernet43 54 eth-0-44 43 1000 none +Ethernet44 57 eth-0-45 44 1000 none +Ethernet45 56 eth-0-46 45 1000 none +Ethernet46 59 eth-0-47 46 1000 none +Ethernet47 58 eth-0-48 47 1000 none +Ethernet48 13 eth-0-49 48 10000 none +Ethernet49 12 eth-0-50 49 10000 none +Ethernet50 15 eth-0-51 50 10000 none +Ethernet51 14 eth-0-52 51 10000 none diff --git a/device/centec/arm64-centec_e530_48t4x_p-r0/fancontrol b/device/centec/arm64-centec_e530_48t4x_p-r0/fancontrol index e3775297128e..4fbc9cba36ba 100644 --- a/device/centec/arm64-centec_e530_48t4x_p-r0/fancontrol +++ b/device/centec/arm64-centec_e530_48t4x_p-r0/fancontrol @@ -1 +1,12 @@ # Configuration file generated by pwmconfig, changes will be lost +INTERVAL=10 +DEVPATH=hwmon1=devices/platform/soc/soc:fan-ctc5236 +DEVNAME=hwmon1=ctc5236fan +FCTEMPS=hwmon1/pwm1=hwmon1/temp1_input hwmon1/pwm2=hwmon1/temp1_input hwmon1/pwm3=hwmon1/temp1_input +FCFANS=hwmon1/pwm1=hwmon1/fan1_input hwmon1/pwm2=hwmon1/fan2_input hwmon1/pwm3=hwmon1/fan3_input +MINTEMP=hwmon1/pwm1=30 hwmon1/pwm2=30 hwmon1/pwm3=30 +MAXTEMP=hwmon1/pwm1=90 hwmon1/pwm2=90 hwmon1/pwm3=90 +MINSTART=hwmon1/pwm1=12 hwmon1/pwm2=12 hwmon1/pwm3=12 +MINSTOP=hwmon1/pwm1=6 hwmon1/pwm2=6 hwmon1/pwm3=6 +MINPWM=hwmon1/pwm1=6 hwmon1/pwm2=6 hwmon1/pwm3=6 +MAXPWM=hwmon1/pwm1=18 hwmon1/pwm2=18 hwmon1/pwm3=18 diff --git a/device/centec/arm64-centec_e530_48t4x_p-r0/platform_components.json b/device/centec/arm64-centec_e530_48t4x_p-r0/platform_components.json new file mode 100644 index 000000000000..cd0afe73cebd --- /dev/null +++ b/device/centec/arm64-centec_e530_48t4x_p-r0/platform_components.json @@ -0,0 +1,8 @@ +{ + "chassis": { + "E530-48t4x-p": { + "component": { + } + } + } +} diff --git a/device/centec/arm64-centec_e530_48t4x_p-r0/platform_reboot b/device/centec/arm64-centec_e530_48t4x_p-r0/platform_reboot new file mode 100755 index 000000000000..f22723f98dee --- /dev/null +++ b/device/centec/arm64-centec_e530_48t4x_p-r0/platform_reboot @@ -0,0 +1,11 @@ +#!/usr/bin/python +import os + +def main(): + # reboot the system + os.system('echo 502 > /sys/class/gpio/export') + os.system('echo out > /sys/class/gpio/gpio502/direction') + os.system('echo 1 > /sys/class/gpio/gpio502/value') + +if __name__ == "__main__": + main() diff --git a/device/centec/arm64-centec_e530_48t4x_p-r0/plugins/eeprom.py b/device/centec/arm64-centec_e530_48t4x_p-r0/plugins/eeprom.py index afea818be079..4a7613c40d0e 100644 --- a/device/centec/arm64-centec_e530_48t4x_p-r0/plugins/eeprom.py +++ b/device/centec/arm64-centec_e530_48t4x_p-r0/plugins/eeprom.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python + ############################################################################# # Centec E550-24X8Y2C # @@ -10,7 +12,7 @@ try: from sonic_eeprom import eeprom_tlvinfo except ImportError as e: - raise ImportError(str(e) + "- required module not found") + raise ImportError (str(e) + "- required module not found") class board(eeprom_tlvinfo.TlvInfoDecoder): diff --git a/device/centec/arm64-centec_e530_48t4x_p-r0/plugins/led_control.py b/device/centec/arm64-centec_e530_48t4x_p-r0/plugins/led_control.py index eb567de89c22..5b20e882ccef 100644 --- a/device/centec/arm64-centec_e530_48t4x_p-r0/plugins/led_control.py +++ b/device/centec/arm64-centec_e530_48t4x_p-r0/plugins/led_control.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python +# # led_control.py # # Platform-specific LED control functionality for SONiC @@ -21,6 +23,7 @@ def DBG_PRINT(str): class LedControl(LedControlBase): """Platform specific LED control class""" + # Helper method to map SONiC port name to index def _port_name_to_index(self, port_name): # Strip "Ethernet" off port name @@ -28,7 +31,7 @@ def _port_name_to_index(self, port_name): return -1 port_idx = int(port_name[len(self.SONIC_PORT_NAME_PREFIX):]) - return port_idx + return port_idx + 1 def _port_state_to_mode(self, port_idx, state): if state == "up": @@ -70,8 +73,8 @@ def _initDefaultConfig(self): DBG_PRINT("init led done") - # Concrete implementation of port_link_state_change() method + # Concrete implementation of port_link_state_change() method def port_link_state_change(self, portname, state): port_idx = self._port_name_to_index(portname) ledMode = self._port_state_to_mode(port_idx, state) @@ -84,8 +87,8 @@ def port_link_state_change(self, portname, state): self._port_led_mode_update(port_idx, ledMode) DBG_PRINT("update {} led mode from {} to {}".format(portname, saveMode, ledMode)) - # Constructor + # Constructor def __init__(self): self.SONIC_PORT_NAME_PREFIX = "Ethernet" self.LED_MODE_UP = [2, 11] diff --git a/device/centec/arm64-centec_e530_48t4x_p-r0/plugins/psuutil.py b/device/centec/arm64-centec_e530_48t4x_p-r0/plugins/psuutil.py index 3a83f406d990..1e83c12c1131 100644 --- a/device/centec/arm64-centec_e530_48t4x_p-r0/plugins/psuutil.py +++ b/device/centec/arm64-centec_e530_48t4x_p-r0/plugins/psuutil.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python + ############################################################################# # Centec # @@ -9,8 +11,7 @@ try: from sonic_psu.psu_base import PsuBase except ImportError as e: - raise ImportError(str(e) + "- required module not found") - + raise ImportError (str(e) + "- required module not found") class PsuUtil(PsuBase): """Platform-specific PSUutil class""" diff --git a/device/centec/arm64-centec_e530_48t4x_p-r0/plugins/sfputil.py b/device/centec/arm64-centec_e530_48t4x_p-r0/plugins/sfputil.py index f7094828eafb..189e469d47cf 100644 --- a/device/centec/arm64-centec_e530_48t4x_p-r0/plugins/sfputil.py +++ b/device/centec/arm64-centec_e530_48t4x_p-r0/plugins/sfputil.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python + # sfputil.py # # Platform-specific SFP transceiver interface for SONiC @@ -15,6 +17,8 @@ def DBG_PRINT(str): print(str + "\n") +SFP_STATUS_INSERTED = '1' +SFP_STATUS_REMOVED = '0' class SfpUtil(SfpUtilBase): """Platform-specific SfpUtil class""" @@ -42,17 +46,9 @@ def port_to_eeprom_mapping(self): def is_logical_port(self, port_name): return True - def get_logical_to_physical(self, port_name): - if not port_name.startswith(self.SONIC_PORT_NAME_PREFIX): - return None - - port_idx = int(port_name[len(self.SONIC_PORT_NAME_PREFIX):]) - - return [port_idx] - def get_eeprom_data(self, port): ret = None - port_num = self.get_logical_to_physical(port)[0] + port_num = self.get_logical_to_physical(port)[0] + 1 if port_num < self.port_start or port_num > self.port_end: return ret if port_num < self.sfp_base: @@ -65,16 +61,17 @@ def get_eeprom_data(self, port): return ret - # todo - # def _get_port_eeprom_path(self, port_num, devid): - # pass - def __init__(self): self.SONIC_PORT_NAME_PREFIX = "Ethernet" - self.PORT_START = 1 - self.PORT_END = 52 - self.SFP_BASE = 49 + self.PORT_START = 0 + self.PORT_END = 51 + self.SFP_BASE = 48 self.PORTS_IN_BLOCK = 52 + self.logical = [] + self.physical_to_logical = {} + self.logical_to_physical = {} + self.logical_to_asic = {} + self.data = {'valid':0, 'last':0} self.eeprom_mapping = {} self.f_sfp_present = "/sys/class/sfp/sfp{}/sfp_presence" @@ -82,14 +79,16 @@ def __init__(self): for x in range(self.port_start, self.sfp_base): self.eeprom_mapping[x] = None for x in range(self.sfp_base, self.port_end + 1): - self.eeprom_mapping[x] = "/sys/class/sfp/sfp{}/sfp_eeprom".format( - x - self.sfp_base + 1) + self.eeprom_mapping[x] = "/sys/class/sfp/sfp{}/sfp_eeprom".format(x - self.sfp_base + 1) self.presence = {} for x in range(self.sfp_base, self.port_end + 1): - self.presence[x] = False + self.presence[x] = False; SfpUtilBase.__init__(self) + for x in range(self.sfp_base, self.port_end + 1): + self.logical.append('Ethernet' + str(x)) + def get_presence(self, port_num): # Check for invalid port_num if port_num < self.port_start or port_num > self.port_end: @@ -125,13 +124,38 @@ def reset(self, port_num): return False - def get_transceiver_change_event(self, timeout=0): + + def read_porttab_mappings(self, porttabfile, asic_inst = 0): + for x in range(self.sfp_base, self.port_end + 1): + self.logical_to_physical['Ethernet' + str(x)] = [x] + self.logical_to_asic['Ethernet' + str(x)] = 0 + self.physical_to_logical[x] = ['Ethernet' + str(x)] + + def get_transceiver_change_event(self, timeout=2000): + now = time.time() port_dict = {} - while True: - for x in range(self.sfp_base, self.port_end + 1): - presence = self.get_presence(x) - if presence != self.presence[x]: - self.presence[x] = presence - port_dict[x] = presence - return True, 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 x in range(self.sfp_base, self.port_end + 1): + presence = self.get_presence(x) + if presence != self.presence[x]: + self.presence[x] = presence + # index in port_config.ini + if presence: + port_dict[x] = SFP_STATUS_INSERTED + else: + port_dict[x] = 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/arm64-centec_e530_48t4x_p-r0/pmon_daemon_control.json b/device/centec/arm64-centec_e530_48t4x_p-r0/pmon_daemon_control.json new file mode 100644 index 000000000000..0db3279e44b0 --- /dev/null +++ b/device/centec/arm64-centec_e530_48t4x_p-r0/pmon_daemon_control.json @@ -0,0 +1,3 @@ +{ + +} diff --git a/device/centec/x86_64-ew_es6220_x48q2h4-r0/plugins/sfputil.py b/device/centec/x86_64-ew_es6220_x48q2h4-r0/plugins/sfputil.py index 103b3cd5630b..2aced9201620 100644 --- a/device/centec/x86_64-ew_es6220_x48q2h4-r0/plugins/sfputil.py +++ b/device/centec/x86_64-ew_es6220_x48q2h4-r0/plugins/sfputil.py @@ -82,7 +82,7 @@ def get_low_power_mode(self, port_num): try: reg_file = open("/sys/devices/platform/dell-s6000-cpld.0/qsfp_lpmode") except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) content = reg_file.readline().rstrip() diff --git a/platform/centec-arm64/one-image.mk b/platform/centec-arm64/one-image.mk index e8f0cf3690e5..87fd7627b5e4 100755 --- a/platform/centec-arm64/one-image.mk +++ b/platform/centec-arm64/one-image.mk @@ -8,6 +8,8 @@ $(SONIC_ONE_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR) $(SONIC_ONE_IMAGE)_INSTALLS += $(TSINGMA_BSP_MODULE) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(CENTEC_E530_48T4X_P_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(CENTEC_E530_24X2C_PLATFORM_MODULE) +$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(CENTEC_E530_48S4X_PLATFORM_MODULE) +$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(CENTEC_E530_24X2Q_PLATFORM_MODULE) ifeq ($(INSTALL_DEBUG_TOOLS),y) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_DBG_IMAGES) diff --git a/platform/centec-arm64/platform-modules-centec-e530.mk b/platform/centec-arm64/platform-modules-centec-e530.mk index 3058e77a57e3..a5237e67981c 100644 --- a/platform/centec-arm64/platform-modules-centec-e530.mk +++ b/platform/centec-arm64/platform-modules-centec-e530.mk @@ -1,8 +1,10 @@ # Centec E530-48T4X-P Platform modules -CENTEC_E530_48T4X_P_PLATFORM_MODULE_VERSION =1.1 -CENTEC_E530_24X2C_PLATFORM_MODULE_VERSION =1.1 +CENTEC_E530_48T4X_P_PLATFORM_MODULE_VERSION =1.3 +CENTEC_E530_24X2C_PLATFORM_MODULE_VERSION =1.3 +CENTEC_E530_48S4X_PLATFORM_MODULE_VERSION =1.3 +CENTEC_E530_24X2Q_PLATFORM_MODULE_VERSION =1.3 export CENTEC_E530_48T4X_P_PLATFORM_MODULE_VERSION @@ -16,3 +18,11 @@ SONIC_DPKG_DEBS += $(CENTEC_E530_48T4X_P_PLATFORM_MODULE) CENTEC_E530_24X2C_PLATFORM_MODULE = platform-modules-e530-24x2c_$(CENTEC_E530_24X2C_PLATFORM_MODULE_VERSION)_arm64.deb $(CENTEC_E530_24X2C_PLATFORM_MODULE)_PLATFORM = arm64-centec_e530_24x2c-r0 $(eval $(call add_extra_package,$(CENTEC_E530_48T4X_P_PLATFORM_MODULE),$(CENTEC_E530_24X2C_PLATFORM_MODULE))) + +CENTEC_E530_48S4X_PLATFORM_MODULE = platform-modules-e530-48s4x_$(CENTEC_E530_48S4X_PLATFORM_MODULE_VERSION)_arm64.deb +$(CENTEC_E530_48S4X_PLATFORM_MODULE)_PLATFORM = arm64-centec_e530_48s4x-r0 +$(eval $(call add_extra_package,$(CENTEC_E530_48T4X_P_PLATFORM_MODULE),$(CENTEC_E530_48S4X_PLATFORM_MODULE))) + +CENTEC_E530_24X2Q_PLATFORM_MODULE = platform-modules-e530-24x2q_$(CENTEC_E530_24X2Q_PLATFORM_MODULE_VERSION)_arm64.deb +$(CENTEC_E530_24X2Q_PLATFORM_MODULE)_PLATFORM = arm64-centec_e530_24x2q-r0 +$(eval $(call add_extra_package,$(CENTEC_E530_48T4X_P_PLATFORM_MODULE),$(CENTEC_E530_24X2Q_PLATFORM_MODULE))) diff --git a/platform/centec-arm64/platform.conf b/platform/centec-arm64/platform.conf index 2577f64ea274..39dc4b70239a 100755 --- a/platform/centec-arm64/platform.conf +++ b/platform/centec-arm64/platform.conf @@ -4,43 +4,45 @@ echo "Preparing for installation ... " -demo_mnt=/mnt - -hw_load() { - echo "ext4load mmc 0:2 \$loadaddr onie_uimage" -} - create_partition() { echo y | mkfs.ext4 -L CTC-SYSTEM /dev/mmcblk0p1 } mount_partition() { - echo "mount flash" + echo "mount flash partition" + demo_mnt=/mnt mount -t ext4 /dev/mmcblk0p1 $demo_mnt } bootloader_menu_config() { - mkdir -p $demo_mnt/boot - mount -t ext4 /dev/mmcblk0p2 $demo_mnt/boot - - rm $demo_mnt/boot/centec-e530.itb -rf - cp $demo_mnt/$image_dir/boot/sonic_arm64.fit $demo_mnt/boot/centec-e530.itb - cd $demo_mnt/boot - rm onie_uimage -rf - ln -s centec-e530.itb onie_uimage - cd - - sync - umount -l $demo_mnt/boot - - hw_load_str="$(hw_load)" - - (cat < /tmp/env.txt - - fw_setenv -f -s /tmp/env.txt - fw_setenv -f image_dir $image_dir + if [ "$install_env" = "onie" ]; then + fw_setenv -f nos_bootcmd "test -n \$boot_once && setenv do_boot_once \$boot_once && setenv boot_once && saveenv && run do_boot_once; run boot_next" + + fw_setenv -f sonic_image_1 "ext4load mmc 0:1 \$loadaddr \$sonic_dir_1/boot/sonic_arm64.fit && setenv bootargs quiet console=\$consoledev,\$baudrate root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 loopfstype=squashfs loop=\$sonic_dir_1/fs.squashfs systemd.unified_cgroup_hierarchy=0 && bootm \$loadaddr" + fw_setenv -f sonic_image_2 "NONE" + fw_setenv -f sonic_dir_1 $image_dir + fw_setenv -f sonic_dir_2 "NONE" + fw_setenv -f sonic_version_1 `echo $image_dir | sed "s/^image-/SONiC-OS-/g"` + fw_setenv -f sonic_version_2 "NONE" + + fw_setenv -f boot_next "run sonic_image_1" + else + running_sonic_revision=`cat /etc/sonic/sonic_version.yml | grep build_version | awk -F \' '{print $2}'` + SONIC_IMAGE_MAX=2 + idx=0 + for i in $(seq 1 $SONIC_IMAGE_MAX); do + if [ "`fw_printenv sonic_version_$i 2>/dev/null | awk -F = '{print $2}'`" != "SONiC-OS-$running_sonic_revision" ]; then + idx=$i + break + fi + done + + fw_setenv nos_bootcmd "test -n \$boot_once && setenv do_boot_once \$boot_once && setenv boot_once && saveenv && run do_boot_once; run boot_next" + + fw_setenv sonic_image_$idx "ext4load mmc 0:1 \$loadaddr \$sonic_dir_$idx/boot/sonic_arm64.fit && setenv bootargs quiet console=\$consoledev,\$baudrate root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 loopfstype=squashfs loop=\$sonic_dir_$idx/fs.squashfs systemd.unified_cgroup_hierarchy=0 && bootm \$loadaddr" + fw_setenv sonic_dir_$idx $image_dir + fw_setenv sonic_version_$idx `echo $image_dir | sed "s/^image-/SONiC-OS-/g"` + + fw_setenv boot_next "run sonic_image_$idx" + fi } diff --git a/platform/centec-arm64/sai.mk b/platform/centec-arm64/sai.mk index 2b902b49403a..cef055447435 100755 --- a/platform/centec-arm64/sai.mk +++ b/platform/centec-arm64/sai.mk @@ -1,6 +1,6 @@ # Centec SAI -export CENTEC_SAI_VERSION = 1.6.3-1 +export CENTEC_SAI_VERSION = 1.7.1-1 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/setup.py b/platform/centec-arm64/sonic-platform-modules-e530/24x2c/setup.py index 17f8b8f01b55..d41f195d6f2c 100755 --- a/platform/centec-arm64/sonic-platform-modules-e530/24x2c/setup.py +++ b/platform/centec-arm64/sonic-platform-modules-e530/24x2c/setup.py @@ -5,11 +5,11 @@ os.listdir setup( - name='24x2c', - version='1.1', + name='sonic_platform', + version='1.0', description='Module to initialize centec e530-24x2c platforms', - packages=['24x2c'], - package_dir={'24x2c': '24x2c/classes'}, + packages=['sonic_platform'], + package_dir={'sonic_platform': 'sonic_platform'}, ) diff --git a/platform/centec-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/__init__.py b/platform/centec-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/__init__.py new file mode 100644 index 000000000000..d4a9e746e050 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/__init__.py @@ -0,0 +1,3 @@ +__all__ = ["platform", "chassis", "sfp", "eeprom", "psu", "thermal", "fan", "fan_drawer"] +from . import platform + diff --git a/platform/centec-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/chassis.py b/platform/centec-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/chassis.py new file mode 100644 index 000000000000..1dfb0e6d8291 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/chassis.py @@ -0,0 +1,203 @@ +#!/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.eeprom import Eeprom + from .fan_drawer import FanDrawer + from .thermal import Thermal + from .sfp import Sfp + from .psu import Psu + from sonic_py_common import device_info +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +NUM_FAN_TRAY = 1 +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" + +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, "E530-24x2c", "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) + self._fan_drawer_list.append(fandrawer) + self._fan_list.extend(fandrawer._fan_list) + # 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)) + self._sfp_list.append(sfp) + # Initialize PSU + for index in range(0, NUM_PSU): + psu = Psu(index + 1) + self._psu_list.append(psu) + +############################################## +# 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 len(self._psu_list) + + def get_psu(self, psu_index): + return self._psu_list[psu_index] diff --git a/platform/centec-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/eeprom.py b/platform/centec-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/eeprom.py new file mode 100644 index 000000000000..77e3e82df13f --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/eeprom.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python +# +# Name: eeprom.py, version: 1.0 +# +# Description: Module contains the definitions of SONiC platform APIs +# + +try: + 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 = "/dev/mtd3" + 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-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/fan.py b/platform/centec-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/fan.py new file mode 100644 index 000000000000..a2616322633f --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/24x2c/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/hwmon1/" +FAN_MAX_PWM = 255 +FAN_FAN_PWM = "pwm{}" +FAN_FAN_INPUT = "fan{}_input" +FAN_MAX_RPM = 9000 +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 Exception: + 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, 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, 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, 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, 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] + + 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-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/fan_drawer.py b/platform/centec-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/fan_drawer.py new file mode 100644 index 000000000000..b2130520f8bc --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/fan_drawer.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python + +######################################################################## +# Centec E530 24x2c +# +# 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 .fan import Fan +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CENTEC_FANS_PER_FANTRAY = 3 + + +class FanDrawer(FanDrawerBase): + """Centec E530 24x2c 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) diff --git a/platform/centec-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/platform.py b/platform/centec-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/platform.py new file mode 100644 index 000000000000..a69d726eee23 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/24x2c/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 E530-24X2C +# + + +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-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/psu.py b/platform/centec-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/psu.py new file mode 100644 index 000000000000..0e133d15c4c5 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/psu.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python + +from __future__ import print_function + +import imp +import os + +try: + from sonic_platform_base.psu_base import PsuBase + 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 Psu(PsuBase): + """Centec Platform-specific PSU class""" + + def __init__(self, index): + self._index = index + self._fan_list = [] + + 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", "psuutil.py"]) + module = imp.load_source("psuutil", module_file) + psu_util_class = getattr(module, "PsuUtil") + self._psuutil = psu_util_class() + + def _get_psuutil(self): + return self._psuutil + + def get_presence(self): + return self._get_psuutil().get_psu_presence(self._index) + + def get_powergood_status(self): + return self._get_psuutil().get_psu_status(self._index) diff --git a/platform/centec-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/sfp.py b/platform/centec-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/sfp.py new file mode 100644 index 000000000000..4a92fecfa6cf --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/24x2c/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-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/thermal.py b/platform/centec-arm64/sonic-platform-modules-e530/24x2c/sonic_platform/thermal.py new file mode 100644 index 000000000000..ce224f0ed556 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/24x2c/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("SENSOR-1") + + # 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-arm64/sonic-platform-modules-e530/24x2q/modules/Makefile b/platform/centec-arm64/sonic-platform-modules-e530/24x2q/modules/Makefile new file mode 100644 index 000000000000..8736ed3a8d9b --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/24x2q/modules/Makefile @@ -0,0 +1 @@ +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 new file mode 100644 index 000000000000..68830775e003 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/24x2q/modules/centec_e530_24x2q_platform.c @@ -0,0 +1,1111 @@ +#include +#include +#include +#include +#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 24 +#define QSFP_NUM 2 +#define PORT_NUM (SFP_NUM + QSFP_NUM) +#endif + +#if SEP("i2c:smbus") +static int e530_24x2q_smbus_read_reg(struct i2c_client *client, unsigned char reg, unsigned char* value) +{ + int ret = 0; + + if (IS_INVALID_PTR(client)) + { + printk(KERN_CRIT "invalid i2c client"); + return -1; + } + + ret = i2c_smbus_read_byte_data(client, reg); + if (ret >= 0) { + *value = (unsigned char)ret; + } + else + { + *value = 0; + printk(KERN_CRIT "i2c_smbus op failed: ret=%d reg=%d\n",ret ,reg); + return ret; + } + + return 0; +} + +static int e530_24x2q_smbus_write_reg(struct i2c_client *client, unsigned char reg, unsigned char value) +{ + int ret = 0; + + if (IS_INVALID_PTR(client)) + { + printk(KERN_CRIT "invalid i2c client"); + return -1; + } + + ret = i2c_smbus_write_byte_data(client, reg, value); + if (ret != 0) + { + printk(KERN_CRIT "i2c_smbus op failed: ret=%d reg=%d\n",ret ,reg); + return ret; + } + + return 0; +} +#endif + +#if SEP("i2c:master") +static struct i2c_adapter *i2c_adp_master = NULL; /* i2c-1-cpu */ + +static int e530_24x2q_init_i2c_master(void) +{ + /* find i2c-core master */ + i2c_adp_master = i2c_get_adapter(0); + if(IS_INVALID_PTR(i2c_adp_master)) + { + i2c_adp_master = NULL; + printk(KERN_CRIT "e530_24x2q_init_i2c_master can't find i2c-core bus\n"); + return -1; + } + + return 0; +} + +static int e530_24x2q_exit_i2c_master(void) +{ + /* uninstall i2c-core master */ + if(IS_VALID_PTR(i2c_adp_master)) { + i2c_put_adapter(i2c_adp_master); + i2c_adp_master = NULL; + } + + return 0; +} +#endif + +#if SEP("i2c:gpio") +static struct i2c_adapter *i2c_adp_gpio0 = NULL; /* gpio0 */ +static struct i2c_adapter *i2c_adp_gpio1 = NULL; /* gpio1 */ +static struct i2c_adapter *i2c_adp_gpio2 = NULL; /* gpio2 */ +static struct i2c_board_info i2c_dev_gpio0 = { + I2C_BOARD_INFO("i2c-gpio0", 0x21), +}; +static struct i2c_board_info i2c_dev_gpio1 = { + I2C_BOARD_INFO("i2c-gpio1", 0x22), +}; +static struct i2c_board_info i2c_dev_gpio2 = { + I2C_BOARD_INFO("i2c-gpio2", 0x23), +}; +static struct i2c_client *i2c_client_gpio0 = NULL; +static struct i2c_client *i2c_client_gpio1 = NULL; +static struct i2c_client *i2c_client_gpio2 = NULL; + +static int e530_24x2q_init_i2c_gpio(void) +{ + int ret = 0; + + if (IS_INVALID_PTR(i2c_adp_master)) + { + printk(KERN_CRIT "e530_24x2q_init_i2c_gpio can't find i2c-core bus\n"); + return -1; + } + + i2c_adp_gpio0 = i2c_get_adapter(0); + if(IS_INVALID_PTR(i2c_adp_gpio0)) + { + i2c_adp_gpio0 = NULL; + printk(KERN_CRIT "get e530_24x2q gpio0 i2c-adp failed\n"); + return -1; + } + + i2c_client_gpio0 = i2c_new_device(i2c_adp_gpio0, &i2c_dev_gpio0); + if(IS_INVALID_PTR(i2c_client_gpio0)) + { + i2c_client_gpio0 = NULL; + printk(KERN_CRIT "create e530_24x2q board i2c client gpio0 failed\n"); + return -1; + } + + i2c_adp_gpio1 = i2c_get_adapter(0); + if(IS_INVALID_PTR(i2c_adp_gpio1)) + { + i2c_adp_gpio1 = NULL; + printk(KERN_CRIT "get e530_24x2q gpio1 i2c-adp failed\n"); + return -1; + } + + i2c_client_gpio1 = i2c_new_device(i2c_adp_gpio1, &i2c_dev_gpio1); + if(IS_INVALID_PTR(i2c_client_gpio1)) + { + i2c_client_gpio1 = NULL; + printk(KERN_CRIT "create e530_24x2q board i2c client gpio1 failed\n"); + return -1; + } + + i2c_adp_gpio2 = i2c_get_adapter(0); + if(IS_INVALID_PTR(i2c_adp_gpio2)) + { + i2c_adp_gpio2 = NULL; + printk(KERN_CRIT "get e530_24x2q gpio2 i2c-adp failed\n"); + return -1; + } + + i2c_client_gpio2 = i2c_new_device(i2c_adp_gpio2, &i2c_dev_gpio2); + if(IS_INVALID_PTR(i2c_client_gpio2)) + { + i2c_client_gpio2 = NULL; + printk(KERN_CRIT "create e530_24x2q board i2c client gpio2 failed\n"); + return -1; + } + + /* gpio0 */ + ret = e530_24x2q_smbus_write_reg(i2c_client_gpio0, 0x02, 0x00); + ret += e530_24x2q_smbus_write_reg(i2c_client_gpio0, 0x03, 0x00); + ret += e530_24x2q_smbus_write_reg(i2c_client_gpio0, 0x06, 0x00); + ret += e530_24x2q_smbus_write_reg(i2c_client_gpio0, 0x07, 0x00); + /* gpio1 */ + ret += e530_24x2q_smbus_write_reg(i2c_client_gpio1, 0x02, 0xbf); + ret += e530_24x2q_smbus_write_reg(i2c_client_gpio1, 0x03, 0xff); + ret += e530_24x2q_smbus_write_reg(i2c_client_gpio1, 0x06, 0x0c); + ret += e530_24x2q_smbus_write_reg(i2c_client_gpio1, 0x07, 0xff); + /* gpio2 */ + ret += e530_24x2q_smbus_write_reg(i2c_client_gpio2, 0x02, 0x00); + ret += e530_24x2q_smbus_write_reg(i2c_client_gpio2, 0x03, 0xff); + ret += e530_24x2q_smbus_write_reg(i2c_client_gpio2, 0x06, 0x00); + ret += e530_24x2q_smbus_write_reg(i2c_client_gpio2, 0x07, 0xff); + + if (ret) + { + printk(KERN_CRIT "init e530_24x2q board i2c gpio config failed\n"); + return -1; + } + + return 0; +} + +static int e530_24x2q_exit_i2c_gpio(void) +{ + if(IS_VALID_PTR(i2c_client_gpio0)) { + i2c_unregister_device(i2c_client_gpio0); + i2c_client_gpio0 = NULL; + } + + if(IS_VALID_PTR(i2c_adp_gpio0)) + { + i2c_put_adapter(i2c_adp_gpio0); + i2c_adp_gpio0 = NULL; + } + + if(IS_VALID_PTR(i2c_client_gpio1)) { + i2c_unregister_device(i2c_client_gpio1); + i2c_client_gpio1 = NULL; + } + + if(IS_VALID_PTR(i2c_adp_gpio1)) + { + i2c_put_adapter(i2c_adp_gpio1); + i2c_adp_gpio1 = NULL; + } + + if(IS_VALID_PTR(i2c_client_gpio2)) { + i2c_unregister_device(i2c_client_gpio2); + i2c_client_gpio2 = NULL; + } + + if(IS_VALID_PTR(i2c_adp_gpio2)) + { + i2c_put_adapter(i2c_adp_gpio2); + i2c_adp_gpio2 = NULL; + } + + return 0; +} +#endif + + +#if SEP("drivers:psu") +static struct class* psu_class = NULL; +static struct device* psu_dev_psu1 = NULL; +static struct device* psu_dev_psu2 = NULL; + +static ssize_t e530_24x2q_psu_read_presence(struct device *dev, struct device_attribute *attr, char *buf) +{ + int ret = 0; + unsigned char present_no = 0; + unsigned char present = 0; + unsigned char value = 0; + struct i2c_client *i2c_psu_client = NULL; + + if (psu_dev_psu1 == dev) + { + i2c_psu_client = i2c_client_gpio1; + present_no = 9; + } + else if (psu_dev_psu2 == dev) + { + i2c_psu_client = i2c_client_gpio1; + present_no = 13; + } + else + { + return sprintf(buf, "Error: unknown psu device\n"); + } + + if (IS_INVALID_PTR(i2c_psu_client)) + { + return sprintf(buf, "Error: psu i2c-adapter invalid\n"); + } + + ret = e530_24x2q_smbus_read_reg(i2c_psu_client, present_no/8, &present); + if (ret != 0) + { + return sprintf(buf, "Error: read psu data:%s failed\n", attr->attr.name); + } + + value = ((present & (1<<(present_no%8))) ? 1 : 0 ); + + return sprintf(buf, "%d\n", value); +} + +static ssize_t e530_24x2q_psu_read_status(struct device *dev, struct device_attribute *attr, char *buf) +{ + int ret = 0; + unsigned char workstate_no = 0; + unsigned char workstate = 0; + unsigned char value = 0; + struct i2c_client *i2c_psu_client = NULL; + + if (psu_dev_psu1 == dev) + { + i2c_psu_client = i2c_client_gpio1; + workstate_no = 11; + } + else if (psu_dev_psu2 == dev) + { + i2c_psu_client = i2c_client_gpio1; + workstate_no = 15; + } + else + { + return sprintf(buf, "Error: unknown psu device\n"); + } + + if (IS_INVALID_PTR(i2c_psu_client)) + { + return sprintf(buf, "Error: psu i2c-adapter invalid\n"); + } + + ret = e530_24x2q_smbus_read_reg(i2c_psu_client, workstate_no/8, &workstate); + if (ret != 0) + { + return sprintf(buf, "Error: read psu data:%s failed\n", attr->attr.name); + } + + value = ((workstate & (1<<(workstate_no%8))) ? 0 : 1 ); + + return sprintf(buf, "%d\n", value); +} + +static DEVICE_ATTR(psu_presence, S_IRUGO, e530_24x2q_psu_read_presence, NULL); +static DEVICE_ATTR(psu_status, S_IRUGO, e530_24x2q_psu_read_status, NULL); + +static int e530_24x2q_init_psu(void) +{ + int ret = 0; + + psu_class = class_create(THIS_MODULE, "psu"); + if (IS_INVALID_PTR(psu_class)) + { + psu_class = NULL; + printk(KERN_CRIT "create e530_24x2q class psu failed\n"); + return -1; + } + + psu_dev_psu1 = device_create(psu_class, NULL, MKDEV(222,0), NULL, "psu1"); + if (IS_INVALID_PTR(psu_dev_psu1)) + { + psu_dev_psu1 = NULL; + printk(KERN_CRIT "create e530_24x2q psu1 device failed\n"); + return -1; + } + + psu_dev_psu2 = device_create(psu_class, NULL, MKDEV(222,1), NULL, "psu2"); + if (IS_INVALID_PTR(psu_dev_psu2)) + { + psu_dev_psu2 = NULL; + printk(KERN_CRIT "create e530_24x2q psu2 device failed\n"); + return -1; + } + + ret = device_create_file(psu_dev_psu1, &dev_attr_psu_presence); + if (ret != 0) + { + printk(KERN_CRIT "create e530_24x2q psu1 device attr:presence failed\n"); + return -1; + } + + ret = device_create_file(psu_dev_psu1, &dev_attr_psu_status); + if (ret != 0) + { + printk(KERN_CRIT "create e530_24x2q psu1 device attr:status failed\n"); + return -1; + } + + ret = device_create_file(psu_dev_psu2, &dev_attr_psu_presence); + if (ret != 0) + { + printk(KERN_CRIT "create e530_24x2q psu2 device attr:presence failed\n"); + return -1; + } + + ret = device_create_file(psu_dev_psu2, &dev_attr_psu_status); + if (ret != 0) + { + printk(KERN_CRIT "create e530_24x2q psu2 device attr:status failed\n"); + return -1; + } + + return 0; +} + +static int e530_24x2q_exit_psu(void) +{ + if (IS_VALID_PTR(psu_dev_psu1)) + { + device_remove_file(psu_dev_psu1, &dev_attr_psu_presence); + device_remove_file(psu_dev_psu1, &dev_attr_psu_status); + device_destroy(psu_class, MKDEV(222,0)); + } + + if (IS_VALID_PTR(psu_dev_psu2)) + { + device_remove_file(psu_dev_psu2, &dev_attr_psu_presence); + device_remove_file(psu_dev_psu2, &dev_attr_psu_status); + device_destroy(psu_class, MKDEV(222,1)); + } + + if (IS_VALID_PTR(psu_class)) + { + class_destroy(psu_class); + psu_class = NULL; + } + + return 0; +} +#endif + +#if SEP("drivers:leds") +extern void e530_24x2q_led_set(struct led_classdev *led_cdev, enum led_brightness set_value); +extern enum led_brightness e530_24x2q_led_get(struct led_classdev *led_cdev); +extern void e530_24x2q_led_port_set(struct led_classdev *led_cdev, enum led_brightness set_value); +extern enum led_brightness e530_24x2q_led_port_get(struct led_classdev *led_cdev); + +static struct led_classdev led_dev_system = { + .name = "system", + .brightness_set = e530_24x2q_led_set, + .brightness_get = e530_24x2q_led_get, +}; +static struct led_classdev led_dev_idn = { + .name = "idn", + .brightness_set = e530_24x2q_led_set, + .brightness_get = e530_24x2q_led_get, +}; +static struct led_classdev led_dev_fan1 = { + .name = "fan1", + .brightness_set = e530_24x2q_led_set, + .brightness_get = e530_24x2q_led_get, +}; +static struct led_classdev led_dev_fan2 = { + .name = "fan2", + .brightness_set = e530_24x2q_led_set, + .brightness_get = e530_24x2q_led_get, +}; +static struct led_classdev led_dev_fan3 = { + .name = "fan3", + .brightness_set = e530_24x2q_led_set, + .brightness_get = e530_24x2q_led_get, +}; +static struct led_classdev led_dev_fan4 = { + .name = "fan4", + .brightness_set = e530_24x2q_led_set, + .brightness_get = e530_24x2q_led_get, +}; +static struct led_classdev led_dev_psu1 = { + .name = "psu1", + .brightness_set = e530_24x2q_led_set, + .brightness_get = e530_24x2q_led_get, +}; +static struct led_classdev led_dev_psu2 = { + .name = "psu2", + .brightness_set = e530_24x2q_led_set, + .brightness_get = e530_24x2q_led_get, +}; +static struct led_classdev led_dev_port[PORT_NUM] = { +{ .name = "port1", .brightness_set = e530_24x2q_led_port_set, .brightness_get = e530_24x2q_led_port_get,}, +{ .name = "port2", .brightness_set = e530_24x2q_led_port_set, .brightness_get = e530_24x2q_led_port_get,}, +{ .name = "port3", .brightness_set = e530_24x2q_led_port_set, .brightness_get = e530_24x2q_led_port_get,}, +{ .name = "port4", .brightness_set = e530_24x2q_led_port_set, .brightness_get = e530_24x2q_led_port_get,}, +{ .name = "port5", .brightness_set = e530_24x2q_led_port_set, .brightness_get = e530_24x2q_led_port_get,}, +{ .name = "port6", .brightness_set = e530_24x2q_led_port_set, .brightness_get = e530_24x2q_led_port_get,}, +{ .name = "port7", .brightness_set = e530_24x2q_led_port_set, .brightness_get = e530_24x2q_led_port_get,}, +{ .name = "port8", .brightness_set = e530_24x2q_led_port_set, .brightness_get = e530_24x2q_led_port_get,}, +{ .name = "port9", .brightness_set = e530_24x2q_led_port_set, .brightness_get = e530_24x2q_led_port_get,}, +{ .name = "port10", .brightness_set = e530_24x2q_led_port_set, .brightness_get = e530_24x2q_led_port_get,}, +{ .name = "port11", .brightness_set = e530_24x2q_led_port_set, .brightness_get = e530_24x2q_led_port_get,}, +{ .name = "port12", .brightness_set = e530_24x2q_led_port_set, .brightness_get = e530_24x2q_led_port_get,}, +{ .name = "port13", .brightness_set = e530_24x2q_led_port_set, .brightness_get = e530_24x2q_led_port_get,}, +{ .name = "port14", .brightness_set = e530_24x2q_led_port_set, .brightness_get = e530_24x2q_led_port_get,}, +{ .name = "port15", .brightness_set = e530_24x2q_led_port_set, .brightness_get = e530_24x2q_led_port_get,}, +{ .name = "port16", .brightness_set = e530_24x2q_led_port_set, .brightness_get = e530_24x2q_led_port_get,}, +{ .name = "port17", .brightness_set = e530_24x2q_led_port_set, .brightness_get = e530_24x2q_led_port_get,}, +{ .name = "port18", .brightness_set = e530_24x2q_led_port_set, .brightness_get = e530_24x2q_led_port_get,}, +{ .name = "port19", .brightness_set = e530_24x2q_led_port_set, .brightness_get = e530_24x2q_led_port_get,}, +{ .name = "port20", .brightness_set = e530_24x2q_led_port_set, .brightness_get = e530_24x2q_led_port_get,}, +{ .name = "port21", .brightness_set = e530_24x2q_led_port_set, .brightness_get = e530_24x2q_led_port_get,}, +{ .name = "port22", .brightness_set = e530_24x2q_led_port_set, .brightness_get = e530_24x2q_led_port_get,}, +{ .name = "port23", .brightness_set = e530_24x2q_led_port_set, .brightness_get = e530_24x2q_led_port_get,}, +{ .name = "port24", .brightness_set = e530_24x2q_led_port_set, .brightness_get = e530_24x2q_led_port_get,}, +{ .name = "port25", .brightness_set = e530_24x2q_led_port_set, .brightness_get = e530_24x2q_led_port_get,}, +{ .name = "port26", .brightness_set = e530_24x2q_led_port_set, .brightness_get = e530_24x2q_led_port_get,}, +}; +static unsigned char port_led_mode[PORT_NUM] = {0}; + +void e530_24x2q_led_set(struct led_classdev *led_cdev, enum led_brightness set_value) +{ + int ret = 0; + unsigned char reg = 0; + unsigned char mask = 0; + unsigned char shift = 0; + unsigned char led_value = 0; + struct i2c_client *i2c_led_client = i2c_client_gpio1; + + if (0 == strcmp(led_dev_system.name, led_cdev->name)) + { + reg = 0x2; + mask = 0x60; + shift = 5; + } + else if (0 == strcmp(led_dev_idn.name, led_cdev->name)) + { + reg = 0x2; + mask = 0x10; + shift = 4; + } + else if (0 == strcmp(led_dev_fan1.name, led_cdev->name)) + { + goto not_support; + } + else if (0 == strcmp(led_dev_fan2.name, led_cdev->name)) + { + goto not_support; + } + else if (0 == strcmp(led_dev_fan3.name, led_cdev->name)) + { + goto not_support; + } + else if (0 == strcmp(led_dev_fan4.name, led_cdev->name)) + { + goto not_support; + } + else if (0 == strcmp(led_dev_psu1.name, led_cdev->name)) + { + goto not_support; + } + else if (0 == strcmp(led_dev_psu2.name, led_cdev->name)) + { + goto not_support; + } + else + { + goto not_support; + } + + ret = e530_24x2q_smbus_read_reg(i2c_led_client, reg, &led_value); + if (ret != 0) + { + printk(KERN_CRIT "Error: read %s led attr failed\n", led_cdev->name); + return; + } + + led_value = ((led_value & (~mask)) | ((set_value << shift) & (mask))); + + ret = e530_24x2q_smbus_write_reg(i2c_led_client, reg, led_value); + if (ret != 0) + { + printk(KERN_CRIT "Error: write %s led attr failed\n", led_cdev->name); + return; + } + + return; + +not_support: + + printk(KERN_INFO "Error: led not support device:%s\n", led_cdev->name); + return; +} + +enum led_brightness e530_24x2q_led_get(struct led_classdev *led_cdev) +{ + int ret = 0; + unsigned char reg = 0; + unsigned char mask = 0; + unsigned char shift = 0; + unsigned char led_value = 0; + struct i2c_client *i2c_led_client = i2c_client_gpio0; + + if (0 == strcmp(led_dev_system.name, led_cdev->name)) + { + reg = 0x2; + mask = 0x60; + shift = 5; + } + else if (0 == strcmp(led_dev_idn.name, led_cdev->name)) + { + reg = 0x2; + mask = 0x10; + shift = 4; + } + else if (0 == strcmp(led_dev_fan1.name, led_cdev->name)) + { + goto not_support; + } + else if (0 == strcmp(led_dev_fan2.name, led_cdev->name)) + { + goto not_support; + } + else if (0 == strcmp(led_dev_fan3.name, led_cdev->name)) + { + goto not_support; + } + else if (0 == strcmp(led_dev_fan4.name, led_cdev->name)) + { + goto not_support; + } + else if (0 == strcmp(led_dev_psu1.name, led_cdev->name)) + { + goto not_support; + } + else if (0 == strcmp(led_dev_psu2.name, led_cdev->name)) + { + goto not_support; + } + else + { + goto not_support; + } + + ret = e530_24x2q_smbus_read_reg(i2c_led_client, reg, &led_value); + if (ret != 0) + { + printk(KERN_CRIT "Error: read %s led attr failed\n", led_cdev->name); + return 0; + } + + led_value = ((led_value & mask) >> shift); + + return led_value; + +not_support: + + printk(KERN_INFO "Error: not support device:%s\n", led_cdev->name); + return 0; +} + +void e530_24x2q_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-1] = set_value; + + return; +} + +enum led_brightness e530_24x2q_led_port_get(struct led_classdev *led_cdev) +{ + int portNum = 0; + + sscanf(led_cdev->name, "port%d", &portNum); + + return port_led_mode[portNum-1]; +} + +static int e530_24x2q_init_led(void) +{ + int ret = 0; + int i = 0; + + ret = led_classdev_register(NULL, &led_dev_system); + if (ret != 0) + { + printk(KERN_CRIT "create e530_24x2q led_dev_system device failed\n"); + return -1; + } + + ret = led_classdev_register(NULL, &led_dev_idn); + if (ret != 0) + { + printk(KERN_CRIT "create e530_24x2q led_dev_idn device failed\n"); + return -1; + } + + ret = led_classdev_register(NULL, &led_dev_fan1); + if (ret != 0) + { + printk(KERN_CRIT "create e530_24x2q led_dev_fan1 device failed\n"); + return -1; + } + + ret = led_classdev_register(NULL, &led_dev_fan2); + if (ret != 0) + { + printk(KERN_CRIT "create e530_24x2q led_dev_fan2 device failed\n"); + return -1; + } + + ret = led_classdev_register(NULL, &led_dev_fan3); + if (ret != 0) + { + printk(KERN_CRIT "create e530_24x2q led_dev_fan3 device failed\n"); + return -1; + } + + ret = led_classdev_register(NULL, &led_dev_fan4); + if (ret != 0) + { + printk(KERN_CRIT "create e530_24x2q led_dev_fan4 device failed\n"); + return -1; + } + + ret = led_classdev_register(NULL, &led_dev_psu1); + if (ret != 0) + { + printk(KERN_CRIT "create e530_24x2q led_dev_psu1 device failed\n"); + return -1; + } + + ret = led_classdev_register(NULL, &led_dev_psu2); + if (ret != 0) + { + printk(KERN_CRIT "create e530_24x2q led_dev_psu2 device failed\n"); + return -1; + } + + for (i=0; i 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 e530_24x2q_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 < 1) || (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 e530_24x2q_sfp_read_enable(struct device *dev, struct device_attribute *attr, char *buf) +{ + int ret = 0; + unsigned char value = 0; + unsigned char reg_no = 0; + unsigned char input_bank = 0; + int portNum = 0; + const char *name = dev_name(dev); + struct i2c_client *i2c_sfp_client = NULL; + unsigned long flags = 0; + + sscanf(name, "sfp%d", &portNum); + + if ((portNum < 1) || (portNum > SFP_NUM+QSFP_NUM)) + { + printk(KERN_CRIT "sfp read enable, invalid port number!\n"); + value = 0; + } + + if (portNum <= SFP_NUM) + { + if (portNum >= 1 && portNum <= 16) + { + reg_no = portNum - 1; + i2c_sfp_client = i2c_client_gpio0; + } + else if (portNum > 16 && portNum <= 24) + { + reg_no = portNum - 17; + i2c_sfp_client = i2c_client_gpio2; + } + + input_bank = (reg_no/8) + 0x2; + ret = e530_24x2q_smbus_read_reg(i2c_sfp_client, input_bank, &value); + if (ret != 0) + { + return sprintf(buf, "Error: read sfp enable: %s failed\n", attr->attr.name); + } + + value = ((value & (1<<(reg_no%8))) ? 0 : 1 ); + } + else + { + spin_lock_irqsave(&(sfp_info[portNum].lock), flags); + value = sfp_info[portNum].enable; + spin_unlock_irqrestore(&(sfp_info[portNum].lock), flags); + } + + return sprintf(buf, "%d\n", value); +} + +static ssize_t e530_24x2q_sfp_write_enable(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) +{ + int ret = 0; + unsigned char value = 0; + unsigned char set_value = simple_strtol(buf, NULL, 10); + unsigned char reg_no = 0; + unsigned char input_bank = 0; + unsigned char output_bank = 0; + int portNum = 0; + const char *name = dev_name(dev); + struct i2c_client *i2c_sfp_client = NULL; + unsigned long flags = 0; + + sscanf(name, "sfp%d", &portNum); + + if ((portNum < 1) || (portNum > SFP_NUM+QSFP_NUM)) + { + printk(KERN_CRIT "sfp read enable, invalid port number!\n"); + return size; + } + + if (portNum <= SFP_NUM) + { + if (portNum >= 1 && portNum <= 16) + { + reg_no = portNum - 1; + i2c_sfp_client = i2c_client_gpio0; + } + else if (portNum > 16 && portNum <= 24) + { + reg_no = portNum - 17; + i2c_sfp_client = i2c_client_gpio2; + } + + set_value = ((set_value > 0) ? 0 : 1); + + input_bank = (reg_no/8) + 0x2; + ret = e530_24x2q_smbus_read_reg(i2c_sfp_client, input_bank, &value); + if (ret != 0) + { + printk(KERN_CRIT "Error: read %s enable failed\n", name); + return size; + } + + if (set_value) + { + value = (value | (1<<(reg_no % 8))); + } + else + { + value = (value & (~(1<<(reg_no % 8)))); + } + + output_bank = (reg_no/8) + 0x2; + ret = e530_24x2q_smbus_write_reg(i2c_sfp_client, output_bank, value); + if (ret != 0) + { + printk(KERN_CRIT "Error: write %s enable failed\n", name); + return size; + } + } + else + { + set_value = ((set_value > 0) ? 1 : 0); + + spin_lock_irqsave(&(sfp_info[portNum].lock), flags); + sfp_info[portNum].enable = set_value; + spin_unlock_irqrestore(&(sfp_info[portNum].lock), flags); + } + + return size; +} + +static ssize_t e530_24x2q_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 < 1) || (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 e530_24x2q_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 < 1) || (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, e530_24x2q_sfp_read_presence, e530_24x2q_sfp_write_presence); +static DEVICE_ATTR(sfp_enable, S_IRUGO|S_IWUSR, e530_24x2q_sfp_read_enable, e530_24x2q_sfp_write_enable); +static DEVICE_ATTR(sfp_eeprom, S_IRUGO|S_IWUSR, e530_24x2q_sfp_read_eeprom, e530_24x2q_sfp_write_eeprom); + +static int e530_24x2q_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 e530_24x2q class sfp failed\n"); + return -1; + } + + for (i=1; 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 e530_24x2q 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 e530_24x2q 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 e530_24x2q 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 e530_24x2q sfp[%d] device attr:eeprom failed\n", i); + continue; + } + } + + return ret; +} + +static int e530_24x2q_exit_sfp(void) +{ + int i = 0; + + for (i=1; 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 e530_24x2q_init(void) +{ + int ret = 0; + int failed = 0; + + printk(KERN_ALERT "install e530_24x2q board dirver...\n"); + + ret = e530_24x2q_init_i2c_master(); + if (ret != 0) + { + failed = 1; + } + + ret = e530_24x2q_init_i2c_gpio(); + if (ret != 0) + { + failed = 1; + } + + ret = e530_24x2q_init_psu(); + if (ret != 0) + { + failed = 1; + } + + ret = e530_24x2q_init_led(); + if (ret != 0) + { + failed = 1; + } + + ret = e530_24x2q_init_sfp(); + if (ret != 0) + { + failed = 1; + } + + if (failed) + printk(KERN_INFO "install e530_24x2q board driver failed\n"); + else + printk(KERN_ALERT "install e530_24x2q board dirver...ok\n"); + + return 0; +} + +static void e530_24x2q_exit(void) +{ + printk(KERN_INFO "uninstall e530_24x2q board dirver...\n"); + + e530_24x2q_exit_sfp(); + e530_24x2q_exit_led(); + e530_24x2q_exit_psu(); + e530_24x2q_exit_i2c_gpio(); + e530_24x2q_exit_i2c_master(); +} + +MODULE_LICENSE("Dual BSD/GPL"); +MODULE_AUTHOR("shil centecNetworks, Inc"); +MODULE_DESCRIPTION("e530-24x2q board driver"); +module_init(e530_24x2q_init); +module_exit(e530_24x2q_exit); diff --git a/platform/centec-arm64/sonic-platform-modules-e530/24x2q/service/24x2q_platform.service b/platform/centec-arm64/sonic-platform-modules-e530/24x2q/service/24x2q_platform.service new file mode 100644 index 000000000000..272fe2d70c96 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/24x2q/service/24x2q_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-e530-24x2q start +ExecStop=-/etc/init.d/platform-modules-e530-24x2q stop +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/centec-arm64/sonic-platform-modules-e530/24x2q/setup.py b/platform/centec-arm64/sonic-platform-modules-e530/24x2q/setup.py new file mode 100644 index 000000000000..c068fb446ddb --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/24x2q/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 e530-24x2q platforms', + + packages=['sonic_platform'], + package_dir={'sonic_platform': 'sonic_platform'}, +) + diff --git a/platform/centec-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/__init__.py b/platform/centec-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/__init__.py new file mode 100644 index 000000000000..d4a9e746e050 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/__init__.py @@ -0,0 +1,3 @@ +__all__ = ["platform", "chassis", "sfp", "eeprom", "psu", "thermal", "fan", "fan_drawer"] +from . import platform + diff --git a/platform/centec-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/chassis.py b/platform/centec-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/chassis.py new file mode 100644 index 000000000000..ab58df284e89 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/chassis.py @@ -0,0 +1,203 @@ +#!/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.eeprom import Eeprom + from .fan_drawer import FanDrawer + from .thermal import Thermal + from .sfp import Sfp + from .psu import Psu + from sonic_py_common import device_info +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +NUM_FAN_TRAY = 1 +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" + +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, "E530-24x2q", "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) + self._fan_drawer_list.append(fandrawer) + self._fan_list.extend(fandrawer._fan_list) + # 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)) + self._sfp_list.append(sfp) + # Initialize PSU + for index in range(0, NUM_PSU): + psu = Psu(index + 1) + self._psu_list.append(psu) + +############################################## +# 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 len(self._psu_list) + + def get_psu(self, psu_index): + return self._psu_list[psu_index] diff --git a/platform/centec-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/eeprom.py b/platform/centec-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/eeprom.py new file mode 100644 index 000000000000..77e3e82df13f --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/eeprom.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python +# +# Name: eeprom.py, version: 1.0 +# +# Description: Module contains the definitions of SONiC platform APIs +# + +try: + 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 = "/dev/mtd3" + 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-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/fan.py b/platform/centec-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/fan.py new file mode 100644 index 000000000000..a2616322633f --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/24x2q/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/hwmon1/" +FAN_MAX_PWM = 255 +FAN_FAN_PWM = "pwm{}" +FAN_FAN_INPUT = "fan{}_input" +FAN_MAX_RPM = 9000 +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 Exception: + 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, 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, 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, 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, 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] + + 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-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/fan_drawer.py b/platform/centec-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/fan_drawer.py new file mode 100644 index 000000000000..50084612969d --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/fan_drawer.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python + +######################################################################## +# Centec E530 24x2q +# +# 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 .fan import Fan +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CENTEC_FANS_PER_FANTRAY = 3 + + +class FanDrawer(FanDrawerBase): + """Centec E530 24x2q 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) diff --git a/platform/centec-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/platform.py b/platform/centec-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/platform.py new file mode 100644 index 000000000000..612055de0e4a --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/24x2q/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 E530-24X2Q +# + + +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-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/psu.py b/platform/centec-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/psu.py new file mode 100644 index 000000000000..0e133d15c4c5 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/psu.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python + +from __future__ import print_function + +import imp +import os + +try: + from sonic_platform_base.psu_base import PsuBase + 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 Psu(PsuBase): + """Centec Platform-specific PSU class""" + + def __init__(self, index): + self._index = index + self._fan_list = [] + + 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", "psuutil.py"]) + module = imp.load_source("psuutil", module_file) + psu_util_class = getattr(module, "PsuUtil") + self._psuutil = psu_util_class() + + def _get_psuutil(self): + return self._psuutil + + def get_presence(self): + return self._get_psuutil().get_psu_presence(self._index) + + def get_powergood_status(self): + return self._get_psuutil().get_psu_status(self._index) diff --git a/platform/centec-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/sfp.py b/platform/centec-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/sfp.py new file mode 100644 index 000000000000..4a92fecfa6cf --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/24x2q/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-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/thermal.py b/platform/centec-arm64/sonic-platform-modules-e530/24x2q/sonic_platform/thermal.py new file mode 100644 index 000000000000..ce224f0ed556 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/24x2q/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("SENSOR-1") + + # 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-arm64/sonic-platform-modules-e530/48s4x/modules/Makefile b/platform/centec-arm64/sonic-platform-modules-e530/48s4x/modules/Makefile new file mode 100644 index 000000000000..b3a639cc40b8 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/48s4x/modules/Makefile @@ -0,0 +1 @@ +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 new file mode 100644 index 000000000000..179db78738e5 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/48s4x/modules/centec_e530_48s4x_platform.c @@ -0,0 +1,1184 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SEP(XXX) 1 + +#if SEP("defines") + +#define CTC_GPIO_BASE 496 +int xirq_gpio_0 = 0; +int xirq_gpio_1 = 0; +int xirq_gpio_15 = 0; +#define IS_INVALID_PTR(_PTR_) ((_PTR_ == NULL) || IS_ERR(_PTR_)) +#define IS_VALID_PTR(_PTR_) (!IS_INVALID_PTR(_PTR_)) +#define SFP_NUM 52 +#define PORT_NUM (SFP_NUM) +#endif + +#if SEP("ctc:pinctl") +u8 ctc_gpio_set(u8 gpio_pin, u8 val) +{ + gpio_set_value_cansleep(gpio_pin + CTC_GPIO_BASE, val); + return 0; +} + +u8 ctc_gpio_get(u8 gpio_pin) +{ + return gpio_get_value_cansleep(gpio_pin + CTC_GPIO_BASE); +} + +u8 ctc_gpio_direction_config(u8 gpio_pin, u8 dir,u8 default_out) +{ + return dir ? gpio_direction_input(gpio_pin + CTC_GPIO_BASE) + : gpio_direction_output(gpio_pin + CTC_GPIO_BASE,default_out); +} + +static void ctc_pincrtl_init(void) +{ + /* configure phy interrupt pin input */ + ctc_gpio_direction_config(0, 1, 0); + + /* aura clock (not use), + * set output for disable phy interrupt, + * tmp code for phy in sdk bug. + */ + ctc_gpio_direction_config(1, 0, 0); + + return; +} + +static void ctc_irq_init(void) +{ + struct device_node *xnp; + for_each_node_by_type(xnp, "ctc-irq") + { + if (of_device_is_compatible(xnp, "centec,ctc-irq")) + { + xirq_gpio_0 = irq_of_parse_and_map(xnp, 0); + printk(KERN_INFO "ctc-irq GPIO0 IRQ is %d\n", xirq_gpio_0); + xirq_gpio_1 = irq_of_parse_and_map(xnp, 1); + printk(KERN_INFO "ctc-irq GPIO1 IRQ is %d\n", xirq_gpio_1); + xirq_gpio_15 = irq_of_parse_and_map(xnp, 2); + printk(KERN_INFO "ctc-irq GPIO15 IRQ is %d\n", xirq_gpio_15); + } + } + return; +} +#endif + +#if SEP("i2c:smbus") +static int e530_48s4x_smbus_read_reg(struct i2c_client *client, unsigned char reg, unsigned char* value) +{ + int ret = 0; + + if (IS_INVALID_PTR(client)) + { + printk(KERN_CRIT "invalid i2c client"); + return -1; + } + + ret = i2c_smbus_read_byte_data(client, reg); + if (ret >= 0) { + *value = (unsigned char)ret; + } + else + { + *value = 0; + printk(KERN_CRIT "i2c_smbus op failed: ret=%d reg=%d\n",ret ,reg); + return ret; + } + + return 0; +} + +static int e530_48s4x_smbus_write_reg(struct i2c_client *client, unsigned char reg, unsigned char value) +{ + int ret = 0; + + if (IS_INVALID_PTR(client)) + { + printk(KERN_CRIT "invalid i2c client"); + return -1; + } + + ret = i2c_smbus_write_byte_data(client, reg, value); + if (ret != 0) + { + printk(KERN_CRIT "i2c_smbus op failed: ret=%d reg=%d\n",ret ,reg); + return ret; + } + + return 0; +} +#endif + +#if SEP("i2c:master") +static struct i2c_adapter *i2c_adp_master = NULL; /* i2c-1-cpu */ + +static int e530_48s4x_init_i2c_master(void) +{ + /* find i2c-core master */ + i2c_adp_master = i2c_get_adapter(0); + if(IS_INVALID_PTR(i2c_adp_master)) + { + i2c_adp_master = NULL; + printk(KERN_CRIT "e530_48s4x_init_i2c_master can't find i2c-core bus\n"); + return -1; + } + + return 0; +} + +static int e530_48s4x_exit_i2c_master(void) +{ + /* uninstall i2c-core master */ + if(IS_VALID_PTR(i2c_adp_master)) { + i2c_put_adapter(i2c_adp_master); + i2c_adp_master = NULL; + } + + return 0; +} +#endif + +#if SEP("i2c:gpio") +static struct i2c_adapter *i2c_adp_gpio0 = NULL; /* gpio0 */ +static struct i2c_board_info i2c_dev_gpio0 = { + I2C_BOARD_INFO("i2c-gpio0", 0x21), +}; +static struct i2c_client *i2c_client_gpio0 = NULL; + +static struct i2c_adapter *i2c_adp_gpio1 = NULL; /* gpio1 */ +static struct i2c_board_info i2c_dev_gpio1 = { + I2C_BOARD_INFO("i2c-gpio1", 0x22), +}; +static struct i2c_client *i2c_client_gpio1 = NULL; + +static int e530_48s4x_init_i2c_gpio(void) +{ + int ret = 0; + + if (IS_INVALID_PTR(i2c_adp_master)) + { + printk(KERN_CRIT "e530_48s4x_init_i2c_gpio can't find i2c-core bus\n"); + return -1; + } + + i2c_adp_gpio0 = i2c_get_adapter(0); + if(IS_INVALID_PTR(i2c_adp_gpio0)) + { + i2c_adp_gpio0 = NULL; + printk(KERN_CRIT "get e530_48s4x gpio0 i2c-adp failed\n"); + return -1; + } + + i2c_client_gpio0 = i2c_new_device(i2c_adp_gpio0, &i2c_dev_gpio0); + if(IS_INVALID_PTR(i2c_client_gpio0)) + { + i2c_client_gpio0 = NULL; + printk(KERN_CRIT "create e530_48s4x board i2c client gpio0 failed\n"); + return -1; + } + + i2c_adp_gpio1 = i2c_get_adapter(0); + if(IS_INVALID_PTR(i2c_adp_gpio1)) + { + i2c_adp_gpio1 = NULL; + printk(KERN_CRIT "get e530_48s4x gpio1 i2c-adp failed\n"); + return -1; + } + + i2c_client_gpio1 = i2c_new_device(i2c_adp_gpio1, &i2c_dev_gpio1); + if(IS_INVALID_PTR(i2c_client_gpio1)) + { + i2c_client_gpio1 = NULL; + printk(KERN_CRIT "create e530_48s4x board i2c client gpio1 failed\n"); + return -1; + } + + if (ret) + { + printk(KERN_CRIT "init e530_48s4x board i2c gpio config failed\n"); + return -1; + } + + return 0; +} + +static int e530_48s4x_exit_i2c_gpio(void) +{ + if(IS_VALID_PTR(i2c_client_gpio0)) { + i2c_unregister_device(i2c_client_gpio0); + i2c_client_gpio0 = NULL; + } + + if(IS_VALID_PTR(i2c_adp_gpio0)) + { + i2c_put_adapter(i2c_adp_gpio0); + i2c_adp_gpio0 = NULL; + } + + if(IS_VALID_PTR(i2c_client_gpio1)) { + i2c_unregister_device(i2c_client_gpio1); + i2c_client_gpio1 = NULL; + } + + if(IS_VALID_PTR(i2c_adp_gpio1)) + { + i2c_put_adapter(i2c_adp_gpio1); + i2c_adp_gpio1 = NULL; + } + + return 0; +} +#endif + +#if SEP("i2c:epld") +static struct i2c_board_info i2c_dev_epld = { + I2C_BOARD_INFO("i2c-epld", 0x36), +}; +static struct i2c_client *i2c_client_epld = NULL; + +static int e530_48s4x_init_i2c_epld(void) +{ + int ret = 0; + + if (IS_INVALID_PTR(i2c_adp_master)) + { + printk(KERN_CRIT "e530_48s4x_init_i2c_epld can't find i2c-core bus\n"); + return -1; + } + + i2c_client_epld = i2c_new_device(i2c_adp_master, &i2c_dev_epld); + if(IS_INVALID_PTR(i2c_client_epld)) + { + i2c_client_epld = NULL; + printk(KERN_CRIT "create e530_48s4x board i2c client epld failed\n"); + return -1; + } + + /* release asic i2c bridge */ + ret = e530_48s4x_smbus_write_reg(i2c_client_epld, 0x05, 0xff); + /* release phy */ + ret += e530_48s4x_smbus_write_reg(i2c_client_epld, 0x07, 0xff); + /* unmask phy interrupt */ + ret += e530_48s4x_smbus_write_reg(i2c_client_epld, 0x0b, 0x00); + + /* set sfp tx enable */ + //ret += e530_48s4x_smbus_write_reg(i2c_client_epld, 0x0e, 0x00); + //ret += e530_48s4x_smbus_write_reg(i2c_client_epld, 0x0f, 0x00); + //ret += e530_48s4x_smbus_write_reg(i2c_client_epld, 0x10, 0x00); + //ret += e530_48s4x_smbus_write_reg(i2c_client_epld, 0x11, 0x00); + //ret += e530_48s4x_smbus_write_reg(i2c_client_epld, 0x12, 0x00); + //ret += e530_48s4x_smbus_write_reg(i2c_client_epld, 0x13, 0x00); + //ret += e530_48s4x_smbus_write_reg(i2c_client_epld, 0x14, 0x00); + + return ret; +} + +static int e530_48s4x_exit_i2c_epld(void) +{ + if(IS_VALID_PTR(i2c_client_epld)) { + i2c_unregister_device(i2c_client_epld); + i2c_client_epld = NULL; + } + + return 0; +} +#endif + +#if SEP("drivers:psu") +static struct class* psu_class = NULL; +static struct device* psu_dev_psu1 = NULL; +static struct device* psu_dev_psu2 = NULL; + +static ssize_t e530_48s4x_psu_read_presence(struct device *dev, struct device_attribute *attr, char *buf) +{ + int ret = 0; + unsigned char present_no = 0; + unsigned char present = 0; + unsigned char value = 0; + struct i2c_client *i2c_psu_client = NULL; + + if (psu_dev_psu1 == dev) + { + i2c_psu_client = i2c_client_epld; + present_no = 0x1e * 8 + 2; + } + else if (psu_dev_psu2 == dev) + { + i2c_psu_client = i2c_client_epld; + present_no = 0x1e * 8 + 3; + } + else + { + return sprintf(buf, "Error: unknown psu device\n"); + } + + if (IS_INVALID_PTR(i2c_psu_client)) + { + return sprintf(buf, "Error: psu i2c-adapter invalid\n"); + } + + ret = e530_48s4x_smbus_read_reg(i2c_psu_client, present_no/8, &present); + if (ret != 0) + { + return sprintf(buf, "Error: read psu data:%s failed\n", attr->attr.name); + } + + value = ((present & (1<<(present_no%8))) ? 1 : 0 ); + + return sprintf(buf, "%d\n", value); +} + +static ssize_t e530_48s4x_psu_read_status(struct device *dev, struct device_attribute *attr, char *buf) +{ + int ret = 0; + unsigned char workstate_no = 0; + unsigned char workstate = 0; + unsigned char value = 0; + struct i2c_client *i2c_psu_client = NULL; + + if (psu_dev_psu1 == dev) + { + i2c_psu_client = i2c_client_epld; + workstate_no = 0x1e * 8 + 4; + } + else if (psu_dev_psu2 == dev) + { + i2c_psu_client = i2c_client_epld; + workstate_no = 0x1e * 8 + 5; + } + else + { + return sprintf(buf, "Error: unknown psu device\n"); + } + + if (IS_INVALID_PTR(i2c_psu_client)) + { + return sprintf(buf, "Error: psu i2c-adapter invalid\n"); + } + + ret = e530_48s4x_smbus_read_reg(i2c_psu_client, workstate_no/8, &workstate); + if (ret != 0) + { + return sprintf(buf, "Error: read psu data:%s failed\n", attr->attr.name); + } + + value = ((workstate & (1<<(workstate_no%8))) ? 0 : 1 ); + + return sprintf(buf, "%d\n", value); +} + +static DEVICE_ATTR(psu_presence, S_IRUGO, e530_48s4x_psu_read_presence, NULL); +static DEVICE_ATTR(psu_status, S_IRUGO, e530_48s4x_psu_read_status, NULL); + +static int e530_48s4x_init_psu(void) +{ + int ret = 0; + + psu_class = class_create(THIS_MODULE, "psu"); + if (IS_INVALID_PTR(psu_class)) + { + psu_class = NULL; + printk(KERN_CRIT "create e530_48s4x class psu failed\n"); + return -1; + } + + psu_dev_psu1 = device_create(psu_class, NULL, MKDEV(222,0), NULL, "psu1"); + if (IS_INVALID_PTR(psu_dev_psu1)) + { + psu_dev_psu1 = NULL; + printk(KERN_CRIT "create e530_48s4x psu1 device failed\n"); + return -1; + } + + psu_dev_psu2 = device_create(psu_class, NULL, MKDEV(222,1), NULL, "psu2"); + if (IS_INVALID_PTR(psu_dev_psu2)) + { + psu_dev_psu2 = NULL; + printk(KERN_CRIT "create e530_48s4x psu2 device failed\n"); + return -1; + } + + ret = device_create_file(psu_dev_psu1, &dev_attr_psu_presence); + if (ret != 0) + { + printk(KERN_CRIT "create e530_48s4x psu1 device attr:presence failed\n"); + return -1; + } + + ret = device_create_file(psu_dev_psu1, &dev_attr_psu_status); + if (ret != 0) + { + printk(KERN_CRIT "create e530_48s4x psu1 device attr:status failed\n"); + return -1; + } + + ret = device_create_file(psu_dev_psu2, &dev_attr_psu_presence); + if (ret != 0) + { + printk(KERN_CRIT "create e530_48s4x psu2 device attr:presence failed\n"); + return -1; + } + + ret = device_create_file(psu_dev_psu2, &dev_attr_psu_status); + if (ret != 0) + { + printk(KERN_CRIT "create e530_48s4x psu2 device attr:status failed\n"); + return -1; + } + + return 0; +} + +static int e530_48s4x_exit_psu(void) +{ + if (IS_VALID_PTR(psu_dev_psu1)) + { + device_remove_file(psu_dev_psu1, &dev_attr_psu_presence); + device_remove_file(psu_dev_psu1, &dev_attr_psu_status); + device_destroy(psu_class, MKDEV(222,0)); + } + + if (IS_VALID_PTR(psu_dev_psu2)) + { + device_remove_file(psu_dev_psu2, &dev_attr_psu_presence); + device_remove_file(psu_dev_psu2, &dev_attr_psu_status); + device_destroy(psu_class, MKDEV(222,1)); + } + + if (IS_VALID_PTR(psu_class)) + { + class_destroy(psu_class); + psu_class = NULL; + } + + return 0; +} +#endif + +#if SEP("drivers:leds") +extern void e530_48s4x_led_set(struct led_classdev *led_cdev, enum led_brightness set_value); +extern enum led_brightness e530_48s4x_led_get(struct led_classdev *led_cdev); +extern void e530_48s4x_led_port_set(struct led_classdev *led_cdev, enum led_brightness set_value); +extern enum led_brightness e530_48s4x_led_port_get(struct led_classdev *led_cdev); + +static struct led_classdev led_dev_system = { + .name = "system", + .brightness_set = e530_48s4x_led_set, + .brightness_get = e530_48s4x_led_get, +}; +static struct led_classdev led_dev_idn = { + .name = "idn", + .brightness_set = e530_48s4x_led_set, + .brightness_get = e530_48s4x_led_get, +}; +static struct led_classdev led_dev_fan1 = { + .name = "fan1", + .brightness_set = e530_48s4x_led_set, + .brightness_get = e530_48s4x_led_get, +}; +static struct led_classdev led_dev_fan2 = { + .name = "fan2", + .brightness_set = e530_48s4x_led_set, + .brightness_get = e530_48s4x_led_get, +}; +static struct led_classdev led_dev_fan3 = { + .name = "fan3", + .brightness_set = e530_48s4x_led_set, + .brightness_get = e530_48s4x_led_get, +}; +static struct led_classdev led_dev_fan4 = { + .name = "fan4", + .brightness_set = e530_48s4x_led_set, + .brightness_get = e530_48s4x_led_get, +}; +static struct led_classdev led_dev_psu1 = { + .name = "psu1", + .brightness_set = e530_48s4x_led_set, + .brightness_get = e530_48s4x_led_get, +}; +static struct led_classdev led_dev_psu2 = { + .name = "psu2", + .brightness_set = e530_48s4x_led_set, + .brightness_get = e530_48s4x_led_get, +}; +static struct led_classdev led_dev_port[PORT_NUM] = { +{ .name = "port1", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port2", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port3", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port4", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port5", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port6", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port7", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port8", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port9", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port10", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port11", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port12", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port13", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port14", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port15", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port16", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port17", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port18", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port19", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port20", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port21", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port22", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port23", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port24", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port25", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port26", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port27", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port28", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port29", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port30", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port31", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port32", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port33", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port34", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port35", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port36", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port37", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port38", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port39", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port40", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port41", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port42", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port43", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port44", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port45", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port46", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port47", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port48", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port49", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port50", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port51", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +{ .name = "port52", .brightness_set = e530_48s4x_led_port_set, .brightness_get = e530_48s4x_led_port_get,}, +}; +static unsigned char port_led_mode[PORT_NUM] = {0}; + +void e530_48s4x_led_set(struct led_classdev *led_cdev, enum led_brightness set_value) +{ + int ret = 0; + unsigned char reg = 0; + unsigned char mask = 0; + unsigned char shift = 0; + unsigned char led_value = 0; + struct i2c_client *i2c_led_client = i2c_client_epld; + + if (0 == strcmp(led_dev_system.name, led_cdev->name)) + { + reg = 0x2; + mask = 0x0f; + shift = 0; + } + else if (0 == strcmp(led_dev_idn.name, led_cdev->name)) + { + reg = 0x3; + mask = 0x01; + shift = 0; + } + else if (0 == strcmp(led_dev_fan1.name, led_cdev->name)) + { + goto not_support; + } + else if (0 == strcmp(led_dev_fan2.name, led_cdev->name)) + { + goto not_support; + } + else if (0 == strcmp(led_dev_fan3.name, led_cdev->name)) + { + goto not_support; + } + else if (0 == strcmp(led_dev_fan4.name, led_cdev->name)) + { + goto not_support; + } + else if (0 == strcmp(led_dev_psu1.name, led_cdev->name)) + { + goto not_support; + } + else if (0 == strcmp(led_dev_psu2.name, led_cdev->name)) + { + goto not_support; + } + else + { + goto not_support; + } + + ret = e530_48s4x_smbus_read_reg(i2c_led_client, reg, &led_value); + if (ret != 0) + { + printk(KERN_CRIT "Error: read %s led attr failed\n", led_cdev->name); + return; + } + + led_value = ((led_value & (~mask)) | ((set_value << shift) & (mask))); + + ret = e530_48s4x_smbus_write_reg(i2c_led_client, reg, led_value); + if (ret != 0) + { + printk(KERN_CRIT "Error: write %s led attr failed\n", led_cdev->name); + return; + } + + return; + +not_support: + + printk(KERN_INFO "Error: led not support device:%s\n", led_cdev->name); + return; +} + +enum led_brightness e530_48s4x_led_get(struct led_classdev *led_cdev) +{ + int ret = 0; + unsigned char reg = 0; + unsigned char mask = 0; + unsigned char shift = 0; + unsigned char led_value = 0; + struct i2c_client *i2c_led_client = i2c_client_epld; + + if (0 == strcmp(led_dev_system.name, led_cdev->name)) + { + reg = 0x2; + mask = 0x0f; + shift = 0; + } + else if (0 == strcmp(led_dev_idn.name, led_cdev->name)) + { + reg = 0x3; + mask = 0x01; + shift = 1; + } + else if (0 == strcmp(led_dev_fan1.name, led_cdev->name)) + { + goto not_support; + } + else if (0 == strcmp(led_dev_fan2.name, led_cdev->name)) + { + goto not_support; + } + else if (0 == strcmp(led_dev_fan3.name, led_cdev->name)) + { + goto not_support; + } + else if (0 == strcmp(led_dev_fan4.name, led_cdev->name)) + { + goto not_support; + } + else if (0 == strcmp(led_dev_psu1.name, led_cdev->name)) + { + goto not_support; + } + else if (0 == strcmp(led_dev_psu2.name, led_cdev->name)) + { + goto not_support; + } + else + { + goto not_support; + } + + ret = e530_48s4x_smbus_read_reg(i2c_led_client, reg, &led_value); + if (ret != 0) + { + printk(KERN_CRIT "Error: read %s led attr failed\n", led_cdev->name); + return 0; + } + + led_value = ((led_value & mask) >> shift); + + return led_value; + +not_support: + + printk(KERN_INFO "Error: not support device:%s\n", led_cdev->name); + return 0; +} + +void e530_48s4x_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-1] = set_value; + + return; +} + +enum led_brightness e530_48s4x_led_port_get(struct led_classdev *led_cdev) +{ + int portNum = 0; + + sscanf(led_cdev->name, "port%d", &portNum); + + return port_led_mode[portNum-1]; +} + +static int e530_48s4x_init_led(void) +{ + int ret = 0; + int i = 0; + + ret = led_classdev_register(NULL, &led_dev_system); + if (ret != 0) + { + printk(KERN_CRIT "create e530_48s4x led_dev_system device failed\n"); + return -1; + } + + ret = led_classdev_register(NULL, &led_dev_idn); + if (ret != 0) + { + printk(KERN_CRIT "create e530_48s4x led_dev_idn device failed\n"); + return -1; + } + + ret = led_classdev_register(NULL, &led_dev_fan1); + if (ret != 0) + { + printk(KERN_CRIT "create e530_48s4x led_dev_fan1 device failed\n"); + return -1; + } + + ret = led_classdev_register(NULL, &led_dev_fan2); + if (ret != 0) + { + printk(KERN_CRIT "create e530_48s4x led_dev_fan2 device failed\n"); + return -1; + } + + ret = led_classdev_register(NULL, &led_dev_fan3); + if (ret != 0) + { + printk(KERN_CRIT "create e530_48s4x led_dev_fan3 device failed\n"); + return -1; + } + + ret = led_classdev_register(NULL, &led_dev_fan4); + if (ret != 0) + { + printk(KERN_CRIT "create e530_48s4x led_dev_fan4 device failed\n"); + return -1; + } + + ret = led_classdev_register(NULL, &led_dev_psu1); + if (ret != 0) + { + printk(KERN_CRIT "create e530_48s4x led_dev_psu1 device failed\n"); + return -1; + } + + ret = led_classdev_register(NULL, &led_dev_psu2); + if (ret != 0) + { + printk(KERN_CRIT "create e530_48s4x led_dev_psu2 device failed\n"); + return -1; + } + + for (i=0; i SFP_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 e530_48s4x_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 < 1) || (portNum > SFP_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 e530_48s4x_sfp_read_enable(struct device *dev, struct device_attribute *attr, char *buf) +{ + int ret = 0; + unsigned char value = 0; + unsigned char reg_no = 0; + unsigned char input_bank = 0; + int portNum = 0; + const char *name = dev_name(dev); + struct i2c_client *i2c_sfp_client = NULL; + + sscanf(name, "sfp%d", &portNum); + + if ((portNum < 1) || (portNum > SFP_NUM)) + { + printk(KERN_CRIT "sfp read enable, invalid port number!\n"); + value = 0; + } + + reg_no = portNum - 1; + i2c_sfp_client = i2c_client_epld; + + input_bank = (reg_no/8) + 0xe; + ret = e530_48s4x_smbus_read_reg(i2c_sfp_client, input_bank, &value); + if (ret != 0) + { + return sprintf(buf, "Error: read sfp enable: %s failed\n", attr->attr.name); + } + + value = ((value & (1<<(reg_no%8))) ? 0 : 1 ); + + return sprintf(buf, "%d\n", value); +} + +static ssize_t e530_48s4x_sfp_write_enable(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) +{ + int ret = 0; + unsigned char value = 0; + unsigned char set_value = simple_strtol(buf, NULL, 10); + unsigned char reg_no = 0; + unsigned char input_bank = 0; + unsigned char output_bank = 0; + int portNum = 0; + const char *name = dev_name(dev); + struct i2c_client *i2c_sfp_client = NULL; + + sscanf(name, "sfp%d", &portNum); + + if ((portNum < 1) || (portNum > SFP_NUM)) + { + printk(KERN_CRIT "sfp read enable, invalid port number!\n"); + return size; + } + + reg_no = portNum - 1; + i2c_sfp_client = i2c_client_epld; + + set_value = ((set_value > 0) ? 0 : 1); + + input_bank = (reg_no/8) + 0xe; + ret = e530_48s4x_smbus_read_reg(i2c_sfp_client, input_bank, &value); + if (ret != 0) + { + printk(KERN_CRIT "Error: read %s enable failed\n", name); + return size; + } + + if (set_value) + { + value = (value | (1<<(reg_no % 8))); + } + else + { + value = (value & (~(1<<(reg_no % 8)))); + } + + output_bank = (reg_no/8) + 0xe; + ret = e530_48s4x_smbus_write_reg(i2c_sfp_client, output_bank, value); + if (ret != 0) + { + printk(KERN_CRIT "Error: write %s enable failed\n", name); + return size; + } + + return size; +} + +static ssize_t e530_48s4x_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 < 1) || (portNum > SFP_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].data, sfp_info[portNum].data_len); + size = sfp_info[portNum].data_len; + spin_unlock_irqrestore(&(sfp_info[portNum].lock), flags); + + return size; +} + +static ssize_t e530_48s4x_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 < 1) || (portNum > SFP_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].data, buf, size); + sfp_info[portNum].data_len = size; + spin_unlock_irqrestore(&(sfp_info[portNum].lock), flags); + + return size; +} + +static DEVICE_ATTR(sfp_presence, S_IRUGO|S_IWUSR, e530_48s4x_sfp_read_presence, e530_48s4x_sfp_write_presence); +static DEVICE_ATTR(sfp_enable, S_IRUGO|S_IWUSR, e530_48s4x_sfp_read_enable, e530_48s4x_sfp_write_enable); +static DEVICE_ATTR(sfp_eeprom, S_IRUGO|S_IWUSR, e530_48s4x_sfp_read_eeprom, e530_48s4x_sfp_write_eeprom); +static int e530_48s4x_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 e530_48s4x class sfp failed\n"); + return -1; + } + + for (i=1; i<=SFP_NUM; i++) + { + memset(&(sfp_info[i].data), 0, MAX_SFP_EEPROM_DATA_LEN+1); + sfp_info[i].data_len = 0; + 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 e530_48s4x 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 e530_48s4x 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 e530_48s4x 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 e530_48s4x sfp[%d] device attr:eeprom failed\n", i); + continue; + } + } + + return ret; +} + +static int e530_48s4x_exit_sfp(void) +{ + int i = 0; + + for (i=1; i<=SFP_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 e530_48s4x_init(void) +{ + int ret = 0; + int failed = 0; + + printk(KERN_ALERT "install e530_48s4x board dirver...\n"); + + ctc_irq_init(); + ctc_pincrtl_init(); + + ret = e530_48s4x_init_i2c_master(); + if (ret != 0) + { + failed = 1; + } + + ret = e530_48s4x_init_i2c_gpio(); + if (ret != 0) + { + failed = 1; + } + + ret = e530_48s4x_init_i2c_epld(); + if (ret != 0) + { + failed = 1; + } + + ret = e530_48s4x_init_psu(); + if (ret != 0) + { + failed = 1; + } + + ret = e530_48s4x_init_led(); + if (ret != 0) + { + failed = 1; + } + + ret = e530_48s4x_init_sfp(); + if (ret != 0) + { + failed = 1; + } + + if (failed) + printk(KERN_INFO "install e530_48s4x board driver failed\n"); + else + printk(KERN_ALERT "install e530_48s4x board dirver...ok\n"); + + return 0; +} + +static void e530_48s4x_exit(void) +{ + printk(KERN_INFO "uninstall e530_48s4x board dirver...\n"); + + e530_48s4x_exit_sfp(); + e530_48s4x_exit_led(); + e530_48s4x_exit_psu(); + e530_48s4x_exit_i2c_epld(); + e530_48s4x_exit_i2c_gpio(); + e530_48s4x_exit_i2c_master(); +} + +MODULE_LICENSE("Dual BSD/GPL"); +MODULE_AUTHOR("shil centecNetworks, Inc"); +MODULE_DESCRIPTION("e530-48s4x board driver"); +module_init(e530_48s4x_init); +module_exit(e530_48s4x_exit); diff --git a/platform/centec-arm64/sonic-platform-modules-e530/48s4x/service/48s4x_platform.service b/platform/centec-arm64/sonic-platform-modules-e530/48s4x/service/48s4x_platform.service new file mode 100644 index 000000000000..b98ed2153b56 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/48s4x/service/48s4x_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-e530-48s4x start +ExecStop=-/etc/init.d/platform-modules-e530-48s4x stop +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/centec-arm64/sonic-platform-modules-e530/48s4x/setup.py b/platform/centec-arm64/sonic-platform-modules-e530/48s4x/setup.py new file mode 100644 index 000000000000..d1fe198d2400 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/48s4x/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 e530-48s4x platforms', + + packages=['sonic_platform'], + package_dir={'sonic_platform': 'sonic_platform'}, +) + diff --git a/platform/centec-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/__init__.py b/platform/centec-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/__init__.py new file mode 100644 index 000000000000..d4a9e746e050 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/__init__.py @@ -0,0 +1,3 @@ +__all__ = ["platform", "chassis", "sfp", "eeprom", "psu", "thermal", "fan", "fan_drawer"] +from . import platform + diff --git a/platform/centec-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/chassis.py b/platform/centec-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/chassis.py new file mode 100644 index 000000000000..3183517789f6 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/chassis.py @@ -0,0 +1,173 @@ +#!/usr/bin/env python +# +# Name: chassis.py, version: 1.0 +# +# Description: Module contains the definitions of SONiC platform APIs +# + +try: + from sonic_platform_base.chassis_base import ChassisBase + from sonic_platform.eeprom import Eeprom + from .fan_drawer import FanDrawer + from .thermal import Thermal + from .sfp import Sfp + from .psu import Psu + +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +NUM_FAN_TRAY = 1 +NUM_THERMAL = 1 +NUM_PORT = 52 +NUM_PSU = 2 + +class Chassis(ChassisBase): + + def __init__(self): + ChassisBase.__init__(self) + # Initialize EEPROM + self._eeprom = Eeprom() + # Initialize FAN + for i in range(NUM_FAN_TRAY): + fandrawer = FanDrawer(i) + self._fan_drawer_list.append(fandrawer) + self._fan_list.extend(fandrawer._fan_list) + # Initialize THERMAL + for index in range(0, NUM_THERMAL): + thermal = Thermal(index) + self._thermal_list.append(thermal) + # Initialize SFP + for index in range(0, NUM_PORT): + sfp = Sfp(index) + self._sfp_list.append(sfp) + # Initialize PSU + for index in range(0, NUM_PSU): + psu = Psu(index + 1) + self._psu_list.append(psu) + +############################################## +# 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 len(self._psu_list) + + def get_psu(self, psu_index): + return self._psu_list[psu_index] diff --git a/platform/centec-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/eeprom.py b/platform/centec-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/eeprom.py new file mode 100644 index 000000000000..77e3e82df13f --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/eeprom.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python +# +# Name: eeprom.py, version: 1.0 +# +# Description: Module contains the definitions of SONiC platform APIs +# + +try: + 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 = "/dev/mtd3" + 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-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/fan.py b/platform/centec-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/fan.py new file mode 100644 index 000000000000..a2616322633f --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/48s4x/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/hwmon1/" +FAN_MAX_PWM = 255 +FAN_FAN_PWM = "pwm{}" +FAN_FAN_INPUT = "fan{}_input" +FAN_MAX_RPM = 9000 +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 Exception: + 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, 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, 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, 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, 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] + + 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-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/fan_drawer.py b/platform/centec-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/fan_drawer.py new file mode 100644 index 000000000000..cd6a726d3849 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/fan_drawer.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python + +######################################################################## +# Centec E530 48s4x +# +# 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 .fan import Fan +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CENTEC_FANS_PER_FANTRAY = 4 + + +class FanDrawer(FanDrawerBase): + """Centec E530 48s4x 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) diff --git a/platform/centec-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/platform.py b/platform/centec-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/platform.py new file mode 100644 index 000000000000..3faee64ec0da --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/48s4x/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 E530-48S4X +# + + +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-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/psu.py b/platform/centec-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/psu.py new file mode 100644 index 000000000000..0e133d15c4c5 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/psu.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python + +from __future__ import print_function + +import imp +import os + +try: + from sonic_platform_base.psu_base import PsuBase + 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 Psu(PsuBase): + """Centec Platform-specific PSU class""" + + def __init__(self, index): + self._index = index + self._fan_list = [] + + 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", "psuutil.py"]) + module = imp.load_source("psuutil", module_file) + psu_util_class = getattr(module, "PsuUtil") + self._psuutil = psu_util_class() + + def _get_psuutil(self): + return self._psuutil + + def get_presence(self): + return self._get_psuutil().get_psu_presence(self._index) + + def get_powergood_status(self): + return self._get_psuutil().get_psu_status(self._index) diff --git a/platform/centec-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/sfp.py b/platform/centec-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/sfp.py new file mode 100644 index 000000000000..4a92fecfa6cf --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/48s4x/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-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/thermal.py b/platform/centec-arm64/sonic-platform-modules-e530/48s4x/sonic_platform/thermal.py new file mode 100644 index 000000000000..ce224f0ed556 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/48s4x/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("SENSOR-1") + + # 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-arm64/sonic-platform-modules-e530/48t4x_p/modules/Makefile b/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/modules/Makefile similarity index 100% rename from platform/centec-arm64/sonic-platform-modules-e530/48t4x_p/modules/Makefile rename to platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/modules/Makefile 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 similarity index 93% rename from platform/centec-arm64/sonic-platform-modules-e530/48t4x_p/modules/centec_e530_48t4x_p_platform.c rename to platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/modules/centec_e530_48t4x_p_platform.c index aedbe6601a07..7f5584279ee9 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 @@ -8,16 +8,92 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#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 CTC_GPIO_BASE 496 +int xirq_gpio_0 = 0; +int xirq_gpio_1 = 0; +int xirq_gpio_6 = 0; /* add for E530_48S4X EPLD INT0*/ +int xirq_gpio_7 = 0; /* add for E530_48S4X EPLD INT1*/ +int xirq_gpio_15 = 0; +#define IS_INVALID_PTR(_PTR_) ((_PTR_ == NULL) || IS_ERR(_PTR_)) +#define IS_VALID_PTR(_PTR_) (!IS_INVALID_PTR(_PTR_)) #define SFP_NUM 4 #define PORT_NUM (48+SFP_NUM) #endif +#if SEP("ctc:pinctl") +u8 ctc_gpio_set(u8 gpio_pin, u8 val) +{ + gpio_set_value_cansleep(gpio_pin + CTC_GPIO_BASE, val); + return 0; +} + +u8 ctc_gpio_get(u8 gpio_pin) +{ + return gpio_get_value_cansleep(gpio_pin + CTC_GPIO_BASE); +} + +u8 ctc_gpio_direction_config(u8 gpio_pin, u8 dir,u8 default_out) +{ + return dir ? gpio_direction_input(gpio_pin + CTC_GPIO_BASE) + : gpio_direction_output(gpio_pin + CTC_GPIO_BASE,default_out); +} + +static void ctc_pincrtl_init(void) +{ + /* configure mgmt-phy reset-pin output on product, mgmt-phy release must before this */ + ctc_gpio_direction_config(4, 0, 1); + /* configure power-up pin output on product */ + ctc_gpio_direction_config(6, 0, 0); + /* configure phy interrupt pin input */ + ctc_gpio_direction_config(0, 1, 0); + ctc_gpio_direction_config(1, 1, 0); + /* configure phy reset-pin output, for release phy */ + ctc_gpio_direction_config(5, 0, 1); + + return; +} + +static void ctc_irq_init(void) +{ + struct device_node *xnp; + for_each_node_by_type(xnp, "ctc-irq") + { + if (of_device_is_compatible(xnp, "centec,ctc-irq")) + { + xirq_gpio_0 = irq_of_parse_and_map(xnp, 0); + printk(KERN_INFO "ctc-irq GPIO0 IRQ is %d\n", xirq_gpio_0); + xirq_gpio_1 = irq_of_parse_and_map(xnp, 1); + printk(KERN_INFO "ctc-irq GPIO1 IRQ is %d\n", xirq_gpio_1); + xirq_gpio_15 = irq_of_parse_and_map(xnp, 2); + printk(KERN_INFO "ctc-irq GPIO15 IRQ is %d\n", xirq_gpio_15); + } + } + return; +} +#endif + #if SEP("i2c:smbus") static int e530_48t4x_p_smbus_read_reg(struct i2c_client *client, unsigned char reg, unsigned char* value) { @@ -966,6 +1042,9 @@ static int e530_48t4x_p_init(void) int failed = 0; printk(KERN_ALERT "install e530_48t4x_p board dirver...\n"); + + ctc_irq_init(); + ctc_pincrtl_init(); ret = e530_48t4x_p_init_i2c_master(); if (ret != 0) diff --git a/platform/centec-arm64/sonic-platform-modules-e530/48t4x_p/service/48t4x_p_platform.service b/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/service/48t4x_p_platform.service similarity index 100% rename from platform/centec-arm64/sonic-platform-modules-e530/48t4x_p/service/48t4x_p_platform.service rename to platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/service/48t4x_p_platform.service diff --git a/platform/centec-arm64/sonic-platform-modules-e530/48t4x_p/setup.py b/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/setup.py similarity index 54% rename from platform/centec-arm64/sonic-platform-modules-e530/48t4x_p/setup.py rename to platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/setup.py index eee1cd2a841c..129bcdc26995 100755 --- a/platform/centec-arm64/sonic-platform-modules-e530/48t4x_p/setup.py +++ b/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/setup.py @@ -5,11 +5,11 @@ os.listdir setup( - name='48t4x_p', - version='1.1', + name='sonic_platform', + version='1.0', description='Module to initialize centec e530-48t4x-p platforms', - packages=['48t4x_p'], - package_dir={'48t4x_p': '48t4x_p/classes'}, + packages=['sonic_platform'], + package_dir={'sonic_platform': 'sonic_platform'}, ) diff --git a/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/__init__.py b/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/__init__.py new file mode 100644 index 000000000000..d4a9e746e050 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/__init__.py @@ -0,0 +1,3 @@ +__all__ = ["platform", "chassis", "sfp", "eeprom", "psu", "thermal", "fan", "fan_drawer"] +from . import platform + diff --git a/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/chassis.py b/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/chassis.py new file mode 100644 index 000000000000..3183517789f6 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/chassis.py @@ -0,0 +1,173 @@ +#!/usr/bin/env python +# +# Name: chassis.py, version: 1.0 +# +# Description: Module contains the definitions of SONiC platform APIs +# + +try: + from sonic_platform_base.chassis_base import ChassisBase + from sonic_platform.eeprom import Eeprom + from .fan_drawer import FanDrawer + from .thermal import Thermal + from .sfp import Sfp + from .psu import Psu + +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +NUM_FAN_TRAY = 1 +NUM_THERMAL = 1 +NUM_PORT = 52 +NUM_PSU = 2 + +class Chassis(ChassisBase): + + def __init__(self): + ChassisBase.__init__(self) + # Initialize EEPROM + self._eeprom = Eeprom() + # Initialize FAN + for i in range(NUM_FAN_TRAY): + fandrawer = FanDrawer(i) + self._fan_drawer_list.append(fandrawer) + self._fan_list.extend(fandrawer._fan_list) + # Initialize THERMAL + for index in range(0, NUM_THERMAL): + thermal = Thermal(index) + self._thermal_list.append(thermal) + # Initialize SFP + for index in range(0, NUM_PORT): + sfp = Sfp(index) + self._sfp_list.append(sfp) + # Initialize PSU + for index in range(0, NUM_PSU): + psu = Psu(index + 1) + self._psu_list.append(psu) + +############################################## +# 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 len(self._psu_list) + + def get_psu(self, psu_index): + return self._psu_list[psu_index] diff --git a/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/eeprom.py b/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/eeprom.py new file mode 100644 index 000000000000..77e3e82df13f --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/eeprom.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python +# +# Name: eeprom.py, version: 1.0 +# +# Description: Module contains the definitions of SONiC platform APIs +# + +try: + 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 = "/dev/mtd3" + 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-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/fan.py b/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/fan.py new file mode 100644 index 000000000000..a2616322633f --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/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/hwmon1/" +FAN_MAX_PWM = 255 +FAN_FAN_PWM = "pwm{}" +FAN_FAN_INPUT = "fan{}_input" +FAN_MAX_RPM = 9000 +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 Exception: + 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, 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, 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, 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, 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] + + 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-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/fan_drawer.py b/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/fan_drawer.py new file mode 100644 index 000000000000..410e9abcfe2f --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/fan_drawer.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python + +######################################################################## +# Centec E530 48t4x-p +# +# 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 .fan import Fan +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CENTEC_FANS_PER_FANTRAY = 3 + + +class FanDrawer(FanDrawerBase): + """Centec E530 48t4x-p 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) diff --git a/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/platform.py b/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/platform.py new file mode 100644 index 000000000000..644cca8a463a --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/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 E530-48T4X-P +# + + +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-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/psu.py b/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/psu.py new file mode 100644 index 000000000000..0e133d15c4c5 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/psu.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python + +from __future__ import print_function + +import imp +import os + +try: + from sonic_platform_base.psu_base import PsuBase + 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 Psu(PsuBase): + """Centec Platform-specific PSU class""" + + def __init__(self, index): + self._index = index + self._fan_list = [] + + 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", "psuutil.py"]) + module = imp.load_source("psuutil", module_file) + psu_util_class = getattr(module, "PsuUtil") + self._psuutil = psu_util_class() + + def _get_psuutil(self): + return self._psuutil + + def get_presence(self): + return self._get_psuutil().get_psu_presence(self._index) + + def get_powergood_status(self): + return self._get_psuutil().get_psu_status(self._index) diff --git a/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/sfp.py b/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/sfp.py new file mode 100644 index 000000000000..4a92fecfa6cf --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/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-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/thermal.py b/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/sonic_platform/thermal.py new file mode 100644 index 000000000000..ce224f0ed556 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/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("SENSOR-1") + + # 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-arm64/sonic-platform-modules-e530/debian/changelog b/platform/centec-arm64/sonic-platform-modules-e530/debian/changelog index 6ac3ca4827b9..0a6dc44af7e1 100644 --- a/platform/centec-arm64/sonic-platform-modules-e530/debian/changelog +++ b/platform/centec-arm64/sonic-platform-modules-e530/debian/changelog @@ -1,3 +1,15 @@ +sonic-centec-platform-modules (1.3) unstable; urgency=low + + * Add support for centec e530-24x2q + + -- shil Mon, 21 Sep 2020 13:34:33 +0800 + +sonic-centec-platform-modules (1.2) unstable; urgency=low + + * Add support for centec e530-48t4x-p and e530-24x2c and e530-48s4x + + -- shil Mon, 18 May 2020 13:21:57 +0800 + sonic-centec-platform-modules (1.1) unstable; urgency=low * Add support for centec e530-48t4x-p and e530-24x2c diff --git a/platform/centec-arm64/sonic-platform-modules-e530/debian/control b/platform/centec-arm64/sonic-platform-modules-e530/debian/control index 2a1bc972a8b2..31abd51cdc2d 100644 --- a/platform/centec-arm64/sonic-platform-modules-e530/debian/control +++ b/platform/centec-arm64/sonic-platform-modules-e530/debian/control @@ -14,3 +14,13 @@ Package: platform-modules-e530-24x2c Architecture: arm64 Depends: linux-image-4.19.0-12-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 +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 +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 e0349914b58d..e508d52053e7 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 @@ -12,11 +12,30 @@ # 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=$(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) + fi +} function load_kernel_modules() { + hwaddr=`fw_printenv ethaddr | awk -F = '{print $2}'` + if [ "$hwaddr" != "" ]; then + ifconfig eth0 hw ether $hwaddr + fi depmod -a modprobe centec_e530_24x2c_platform + modprobe fan-ctc5236 modprobe dal modprobe tun modprobe tap @@ -27,6 +46,7 @@ function remove_kernel_modules() modprobe -r tap modprobe -r tun modprobe -r dal + modprobe -r fan-ctc5236 modprobe -r centec_e530_24x2c_platform } @@ -35,6 +55,7 @@ start) echo -n "Load Centec kernel modules... " load_kernel_modules + install_python_api_package echo "done." ;; 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 b74a968fe976..567afa923ace 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,3 +1,2 @@ -../../centec/centec-dal/dal.ko /lib/modules/4.19.0-12-2-arm64/kernel/extra -24x2c/modules/centec_e530_24x2c_platform.ko /lib/modules/4.19.0-12-2-arm64/kernel/extra -24x2c/service/24x2c_platform.service /lib/systemd/system +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 new file mode 100644 index 000000000000..60b3b69a1d38 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-24x2q.init @@ -0,0 +1,82 @@ +#!/bin/bash +# This script load/unload centec kernel modules + +### BEGIN INIT INFO +# Provides: platform-modules-e530-24x2q +# 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=$(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) + fi +} + +function load_kernel_modules() +{ + hwaddr=`fw_printenv ethaddr | awk -F = '{print $2}'` + if [ "$hwaddr" != "" ]; then + ifconfig eth0 hw ether $hwaddr + fi + depmod -a + modprobe centec_e530_24x2q_platform + modprobe fan-ctc5236 + modprobe dal + modprobe tun + modprobe tap +} + +function remove_kernel_modules() +{ + modprobe -r tap + modprobe -r tun + modprobe -r dal + modprobe -r fan-ctc5236 + modprobe -r centec_e530_24x2q_platform +} + +case "$1" in +start) + echo -n "Load Centec kernel modules... " + + load_kernel_modules + install_python_api_package + + 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-e530-24x2q {start|stop}" + exit 1 + ;; +esac + +exit 0 + 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 new file mode 100644 index 000000000000..d572108887af --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-24x2q.install @@ -0,0 +1,2 @@ +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-24x2q.postinst b/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-24x2q.postinst new file mode 100644 index 000000000000..129711dfd1d4 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-24x2q.postinst @@ -0,0 +1,2 @@ +systemctl enable 24x2q_platform.service +systemctl start 24x2q_platform.service 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 new file mode 100644 index 000000000000..1fa1970f64d5 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-48s4x.init @@ -0,0 +1,82 @@ +#!/bin/bash +# This script load/unload centec kernel modules + +### BEGIN INIT INFO +# Provides: platform-modules-e530-48s4x +# 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=$(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) + fi +} + +function load_kernel_modules() +{ + hwaddr=`fw_printenv ethaddr | awk -F = '{print $2}'` + if [ "$hwaddr" != "" ]; then + ifconfig eth0 hw ether $hwaddr + fi + depmod -a + modprobe centec_e530_48s4x_platform + modprobe fan-ctc5236 + modprobe dal + modprobe tun + modprobe tap +} + +function remove_kernel_modules() +{ + modprobe -r tap + modprobe -r tun + modprobe -r dal + modprobe -r fan-ctc5236 + modprobe -r centec_e530_48s4x_platform +} + +case "$1" in +start) + echo -n "Load Centec kernel modules... " + + load_kernel_modules + install_python_api_package + + 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-e530-48s4x {start|stop}" + exit 1 + ;; +esac + +exit 0 + 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 new file mode 100644 index 000000000000..d319f3f65548 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-48s4x.install @@ -0,0 +1,2 @@ +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-48s4x.postinst b/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-48s4x.postinst new file mode 100644 index 000000000000..085c874aabb2 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-48s4x.postinst @@ -0,0 +1,2 @@ +systemctl enable 48s4x_platform.service +systemctl start 48s4x_platform.service 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 b9a6d555b024..cefacf6668b2 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 @@ -12,11 +12,30 @@ # 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=$(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) + fi +} function load_kernel_modules() { + hwaddr=`fw_printenv ethaddr | awk -F = '{print $2}'` + if [ "$hwaddr" != "" ]; then + ifconfig eth0 hw ether $hwaddr + fi depmod -a modprobe centec_e530_48t4x_p_platform + modprobe fan-ctc5236 modprobe dal modprobe tun modprobe tap @@ -27,6 +46,7 @@ function remove_kernel_modules() modprobe -r tap modprobe -r tun modprobe -r dal + modprobe -r fan-ctc5236 modprobe -r centec_e530_48t4x_p_platform } @@ -35,6 +55,7 @@ start) echo -n "Load Centec kernel modules... " load_kernel_modules + install_python_api_package echo "done." ;; 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 7d1c00eebeae..634e57f367ee 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,3 +1,2 @@ -../../centec/centec-dal/dal.ko /lib/modules/4.19.0-12-2-arm64/kernel/extra -48t4x_p/modules/centec_e530_48t4x_p_platform.ko /lib/modules/4.19.0-12-2-arm64/kernel/extra -48t4x_p/service/48t4x_p_platform.service /lib/systemd/system +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 69ab667c063d..0fb2c85a8b1b 100755 --- a/platform/centec-arm64/sonic-platform-modules-e530/debian/rules +++ b/platform/centec-arm64/sonic-platform-modules-e530/debian/rules @@ -13,22 +13,20 @@ include /usr/share/dpkg/pkg-info.mk export INSTALL_MOD_DIR:=extra -PYTHON ?= python2 - -PACKAGE_PRE_NAME := sonic-platform-modules-e530 +PACKAGE_PRE_NAME := platform-modules-e530 KVERSION ?= $(shell uname -r) KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) -MODULE_DIRS:= 48t4x_p 24x2c +MODULE_DIRS:= 48t4x-p 24x2c 48s4x 24x2q MODULE_DIR := modules -UTILS_DIR := utils SERVICE_DIR := service CLASSES_DIR := classes CONF_DIR := conf KDAL_DIR := ../../centec/centec-dal/ +FAN_DIR := fan %: - dh $@ --with systemd,python2,python3 --buildsystem=pybuild + dh $@ clean: dh_testdir @@ -40,9 +38,15 @@ build: (for mod in $(KDAL_DIR); do \ make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/; \ done) + (for mod in $(FAN_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; \ - $(PYTHON) $${mod}/setup.py build; \ + 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) binary: binary-arch binary-indep @@ -64,13 +68,12 @@ 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} etc; \ 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)/$${mod}/$(UTILS_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin/; \ + cp $(MOD_SRC_DIR)/$(FAN_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/; \ - $(PYTHON) $${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/centec-arm64/sonic-platform-modules-e530/fan/Makefile b/platform/centec-arm64/sonic-platform-modules-e530/fan/Makefile new file mode 100644 index 000000000000..07a8237dd9c3 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/fan/Makefile @@ -0,0 +1 @@ +obj-m := fan-ctc5236.o diff --git a/platform/centec-arm64/sonic-platform-modules-e530/fan/fan-ctc5236.c b/platform/centec-arm64/sonic-platform-modules-e530/fan/fan-ctc5236.c new file mode 100644 index 000000000000..96448c7db427 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/fan/fan-ctc5236.c @@ -0,0 +1,268 @@ +/* + * Centec FAN driver + * + * based by pwm-fan.c + * Author: shil + * Copyright 2005-2018, Centec Networks (Suzhou) Co., Ltd. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define CTC_MAX_PWM 255 +#define CTC_MAX_FAN 4 +char *pwmnames[CTC_MAX_FAN] = { "pwm1", "pwm2", "pwm3", "pwm4" }; + +struct fan_ctc5236_data { + struct mutex lock; + struct pwm_device *pwm[CTC_MAX_FAN]; + unsigned int pwm_value[CTC_MAX_FAN]; + long temp; +}; + +static int __ctc_set_pwm(struct fan_ctc5236_data *data, int index, unsigned long pwm) +{ + struct pwm_args pargs; + unsigned long duty; + int ret = 0; + + pwm_get_args(data->pwm[index], &pargs); + + mutex_lock(&data->lock); + if (data->pwm_value[index] == pwm) + goto exit_set_pwm_err; + + duty = DIV_ROUND_UP(pwm * (pargs.period - 1), CTC_MAX_PWM); + ret = pwm_config(data->pwm[index], duty, pargs.period); + if (ret) + goto exit_set_pwm_err; + + if (pwm == 0) + pwm_disable(data->pwm[index]); + + if (data->pwm_value[index] == 0) { + ret = pwm_enable(data->pwm[index]); + if (ret) + goto exit_set_pwm_err; + } + + data->pwm_value[index] = pwm; +exit_set_pwm_err: + mutex_unlock(&data->lock); + return ret; +} + +static ssize_t ctc_set_pwm(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count) +{ + struct fan_ctc5236_data *data = dev_get_drvdata(dev); + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + unsigned long pwm; + int ret; + + if (kstrtoul(buf, 10, &pwm) || pwm > CTC_MAX_PWM) + return -EINVAL; + + ret = __ctc_set_pwm(data, attr->index, pwm); + if (ret) + return ret; + + return count; +} + +static ssize_t ctc_show_pwm(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + struct fan_ctc5236_data *data = dev_get_drvdata(dev); + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + + return sprintf(buf, "%u\n", data->pwm_value[attr->index]); +} + +static ssize_t ctc_show_fan(struct device *dev, struct device_attribute *devattr, + char *buf) +{ + struct fan_ctc5236_data *data = dev_get_drvdata(dev); + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct pwm_capture result; + int ret = 0; + int ratio = 0; + + mutex_lock(&data->lock); + + ret = pwm_capture(data->pwm[attr->index], &result, jiffies_to_msecs(HZ)); + if (ret) + goto exit_show_fan_err; + + if (result.period == 0 || result.duty_cycle == 0) + goto exit_show_fan_err; + + ratio = result.period * 10 / result.duty_cycle; + if (ratio >= 19 && ratio <= 21) + { + mutex_unlock(&data->lock); + return sprintf(buf, "%d\n", (int)(30000000000ll / result.period)); + } + +exit_show_fan_err: + mutex_unlock(&data->lock); + return sprintf(buf, "0\n"); +} + +static ssize_t ctc_show_temp(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + struct fan_ctc5236_data *data = dev_get_drvdata(dev); + + return sprintf(buf, "%ld\n", data->temp); +} + +static ssize_t ctc_set_temp(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count) +{ + struct fan_ctc5236_data *data = dev_get_drvdata(dev); + + if (kstrtol(buf, 10, &(data->temp))) + return -EINVAL; + + return count; +} + + +static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR, ctc_show_pwm, ctc_set_pwm, 0); +static SENSOR_DEVICE_ATTR(pwm2, S_IRUGO | S_IWUSR, ctc_show_pwm, ctc_set_pwm, 1); +static SENSOR_DEVICE_ATTR(pwm3, S_IRUGO | S_IWUSR, ctc_show_pwm, ctc_set_pwm, 2); +static SENSOR_DEVICE_ATTR(pwm4, S_IRUGO | S_IWUSR, ctc_show_pwm, ctc_set_pwm, 3); +static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, ctc_show_fan, NULL, 0); +static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, ctc_show_fan, NULL, 1); +static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, ctc_show_fan, NULL, 2); +static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, ctc_show_fan, NULL, 3); +static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO | S_IWUSR, ctc_show_temp, ctc_set_temp, 0); + +static struct attribute *fan_ctc5236_attrs[] = { + &sensor_dev_attr_pwm1.dev_attr.attr, + &sensor_dev_attr_pwm2.dev_attr.attr, + &sensor_dev_attr_pwm3.dev_attr.attr, + &sensor_dev_attr_pwm4.dev_attr.attr, + &sensor_dev_attr_fan1_input.dev_attr.attr, + &sensor_dev_attr_fan2_input.dev_attr.attr, + &sensor_dev_attr_fan3_input.dev_attr.attr, + &sensor_dev_attr_fan4_input.dev_attr.attr, + &sensor_dev_attr_temp1_input.dev_attr.attr, + NULL, +}; + +ATTRIBUTE_GROUPS(fan_ctc5236); + +static int fan_ctc5236_probe(struct platform_device *pdev) +{ + struct fan_ctc5236_data *data; + struct pwm_args pargs; + struct device *hwmon; + int duty_cycle; + int ret; + int idx; + + data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + mutex_init(&data->lock); + data->temp = 35000; + + for (idx = 0; idx < CTC_MAX_FAN; idx++) + { + data->pwm[idx] = devm_of_pwm_get(&pdev->dev, pdev->dev.of_node, pwmnames[idx]); + if (IS_ERR(data->pwm[idx])) { + dev_err(&pdev->dev, "Could not get PWM\n"); + return PTR_ERR(data->pwm[idx]); + } + } + + platform_set_drvdata(pdev, data); + + for (idx = 0; idx < CTC_MAX_FAN; idx++) + { + /* + * FIXME: pwm_apply_args() should be removed when switching to the + * atomic PWM API. + */ + pwm_apply_args(data->pwm[idx]); + + /* Set duty cycle to maximum allowed */ + pwm_get_args(data->pwm[idx], &pargs); + + duty_cycle = pargs.period - 1; + data->pwm_value[idx] = CTC_MAX_PWM; + + ret = pwm_config(data->pwm[idx], duty_cycle, pargs.period); + if (ret) { + dev_err(&pdev->dev, "Failed to configure PWM\n"); + return ret; + } + + /* Enbale PWM output */ + ret = pwm_enable(data->pwm[idx]); + if (ret) { + dev_err(&pdev->dev, "Failed to enable PWM\n"); + return ret; + } + } + + hwmon = devm_hwmon_device_register_with_groups(&pdev->dev, "ctc5236fan", + data, fan_ctc5236_groups); + + if (IS_ERR(hwmon)) { + dev_err(&pdev->dev, "Failed to register hwmon device\n"); + for (idx = 0; idx < CTC_MAX_FAN; idx++) + { + pwm_disable(data->pwm[idx]); + } + return PTR_ERR(hwmon); + } + + return 0; +} + +static int fan_ctc5236_remove(struct platform_device *pdev) +{ + struct fan_ctc5236_data *data = platform_get_drvdata(pdev); + int idx; + + for (idx = 0; idx < CTC_MAX_FAN; idx++) + { + if (data->pwm_value[idx]) + pwm_disable(data->pwm[idx]); + } + return 0; +} + +static const struct of_device_id of_fan_ctc5236_match[] = { + { .compatible = "fan-ctc5236", }, + {}, +}; +MODULE_DEVICE_TABLE(of, of_fan_ctc5236_match); + +static struct platform_driver fan_ctc5236_driver = { + .probe = fan_ctc5236_probe, + .remove = fan_ctc5236_remove, + .driver = { + .name = "fan-ctc5236", + .of_match_table = of_fan_ctc5236_match, + }, +}; + +module_platform_driver(fan_ctc5236_driver); + +MODULE_AUTHOR("Shi Lei "); +MODULE_ALIAS("platform:fan-ctc5236"); +MODULE_DESCRIPTION("CTC5236 FAN driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/centec/centec-dal/dal_common.h b/platform/centec/centec-dal/dal_common.h index d8d4d6a67c0d..d9f410e552af 100644 --- a/platform/centec/centec-dal/dal_common.h +++ b/platform/centec/centec-dal/dal_common.h @@ -14,7 +14,7 @@ extern "C" { #endif -#define DAL_MAX_CHIP_NUM 8 /* DAL support max chip num is 8 */ +#define DAL_MAX_CHIP_NUM 4 /* DAL support max chip num is 4 */ #define DAL_MAX_INTR_NUM 8 #define DAL_NETIF_T_PORT 0 @@ -23,6 +23,10 @@ extern "C" { #define DAL_MAX_KNET_NETIF 64 #define DAL_MAX_KNET_NAME_LEN 32 +#define DAL_PCI_CMD_STATUS 0x0 +#define DAL_PCI_ADDR 0x4 +#define DAL_PCI_DATA_BUF 0x8 + enum dal_operate_code_e { DAL_OP_CREATE, @@ -44,7 +48,7 @@ struct dal_dma_info_s }; typedef struct dal_dma_info_s dal_dma_info_t; -struct dal_dma_chan_s +struct dal_dma_chan_s { unsigned char lchip; unsigned char channel_id; @@ -111,6 +115,64 @@ struct dal_pci_dev_s }; typedef struct dal_pci_dev_s dal_pci_dev_t; +#ifndef HOST_IS_LE +#define HOST_IS_LE 1 +#endif + +#if (HOST_IS_LE == 0) + +/* pci cmd struct define */ +typedef struct pci_cmd_status_s +{ + unsigned int pcieReqOverlap : 1; + unsigned int wrReqState : 3; + unsigned int pciePoison : 1; + unsigned int rcvregInProc : 1; + unsigned int regInProc : 1; + unsigned int reqProcAckCnt : 5; + unsigned int reqProcAckError : 1; + unsigned int reqProcTimeout : 1; + unsigned int reqProcError : 1; + unsigned int reqProcDone : 1; + unsigned int pcieDataError : 1; + unsigned int pcieReqError : 1; + unsigned int reserved : 1; + unsigned int cmdDataLen : 5; + unsigned int cmdEntryWords : 4; + unsigned int pcieReqCmdChk : 3; + unsigned int cmdReadType : 1; +} pci_cmd_status_t; + +#else + +typedef struct pci_cmd_status_s +{ + unsigned int cmdReadType : 1; /* bit0 */ + unsigned int pcieReqCmdChk : 3; /* bit1~3 */ + unsigned int cmdEntryWords : 4; /* bit4~7 */ + unsigned int cmdDataLen : 5; /* bit8~12 */ + unsigned int reserved : 1; /* bit13 */ + unsigned int pcieReqError : 1; + unsigned int pcieDataError : 1; + unsigned int reqProcDone : 1; + unsigned int reqProcError : 1; + unsigned int reqProcTimeout : 1; + unsigned int reqProcAckError : 1; + unsigned int reqProcAckCnt : 5; + unsigned int regInProc : 1; + unsigned int rcvregInProc : 1; + unsigned int pciePoison : 1; + unsigned int wrReqState : 3; + unsigned int pcieReqOverlap : 1; +} pci_cmd_status_t; +#endif + +typedef union pci_cmd_status_u_e +{ + pci_cmd_status_t cmd_status; + unsigned int val; +} pci_cmd_status_u_t; + #ifdef __cplusplus } #endif diff --git a/platform/centec/centec-dal/dal_kernel.c b/platform/centec/centec-dal/dal_kernel.c index 23fc6e736575..1651e803fabc 100644 --- a/platform/centec/centec-dal/dal_kernel.c +++ b/platform/centec/centec-dal/dal_kernel.c @@ -20,6 +20,9 @@ #include #include #include +#if defined(SOC_ACTIVE) +#include +#endif #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)) #include #endif @@ -27,9 +30,6 @@ #include "dal_common.h" #include "dal_mpool.h" #include -#if defined(SOC_ACTIVE) -#include -#endif MODULE_AUTHOR("Centec Networks Inc."); MODULE_DESCRIPTION("DAL kernel module"); MODULE_LICENSE("GPL"); @@ -55,12 +55,12 @@ MODULE_PARM_DESC(dma_pool_size, #define CTC_PCIE_VENDOR_ID 0xcb10 #define CTC_DUET2_DEVICE_ID 0x7148 #define CTC_TSINGMA_DEVICE_ID 0x5236 +#define CTC_TSINGMA_MX_DEVICE_ID 0x8180 #define MEM_MAP_RESERVE SetPageReserved #define MEM_MAP_UNRESERVE ClearPageReserved #define CTC_GREATBELT_DEVICE_ID 0x03e8 /* TBD */ -#define DAL_MAX_CHIP_NUM 8 #define VIRT_TO_PAGE(p) virt_to_page((p)) #define DAL_UNTAG_BLOCK 0 #define DAL_DISCARD_BLOCK 1 @@ -99,8 +99,14 @@ typedef struct dal_kernel_local_dev_s /* PCI I/O mapped base address */ void __iomem * logic_address; + /* Dma ctl I/O mapped base address */ + void __iomem * dma_logic_address; + /* Physical address */ uintptr phys_address; + + /* Dma ctl Physical address*/ + uintptr dma_phys_address; } dal_kern_local_dev_t; #endif @@ -158,8 +164,15 @@ static int dal_intr_num = 0; static int use_high_memory = 0; static unsigned int* dma_virt_base[DAL_MAX_CHIP_NUM]; static unsigned long long dma_phy_base[DAL_MAX_CHIP_NUM]; +#if defined(SOC_ACTIVE) static unsigned int dma_mem_size = 0xc00000; -static unsigned int msi_irq_base[DAL_MAX_CHIP_NUM]; +#else +static unsigned int dma_mem_size = 0x8000000; +#endif +static unsigned int* wb_virt_base[DAL_MAX_CHIP_NUM]; +static unsigned long long wb_phy_base[DAL_MAX_CHIP_NUM]; +static unsigned int wb_mem_size = 0x16000000; +static unsigned int msi_irq_base[DAL_MAX_CHIP_NUM][CTC_MAX_INTR_NUM]; static unsigned int msi_irq_num[DAL_MAX_CHIP_NUM]; static unsigned int msi_used = 0; static unsigned int active_type[DAL_MAX_CHIP_NUM] = {0}; @@ -177,6 +190,7 @@ static struct pci_device_id dal_id_table[] = {PCI_DEVICE((CTC_PCIE_VENDOR_ID+1), (CTC_GOLDENGATE_DEVICE_ID+1))}, {PCI_DEVICE(CTC_PCIE_VENDOR_ID, CTC_DUET2_DEVICE_ID)}, {PCI_DEVICE(CTC_PCIE_VENDOR_ID, CTC_TSINGMA_DEVICE_ID)}, + {PCI_DEVICE(CTC_PCIE_VENDOR_ID, CTC_TSINGMA_MX_DEVICE_ID)}, {0, }, }; #if defined(SOC_ACTIVE) @@ -251,25 +265,14 @@ intr0_handler(int irq, void* dev_id) disable_irq_nosync(irq); - if (p_dal_isr) - { - if (p_dal_isr->isr) - { - /* kernel mode interrupt handler */ - p_dal_isr->isr(p_dal_isr->isr_data); - } - else if ((NULL == p_dal_isr->isr) && (NULL == p_dal_isr->isr_data)) - { - /* user mode interrupt handler */ - poll_intr_trigger[0] = 1; - wake_up(&poll_intr[0]); - } + /* user mode interrupt handler */ + poll_intr_trigger[0] = 1; + wake_up(&poll_intr[0]); - if (p_dal_isr->isr_knet) - { - /* kernel mode interrupt handler */ - p_dal_isr->isr_knet(p_dal_isr->isr_knet_data); - } + if (p_dal_isr->isr_knet) + { + /* kernel mode interrupt handler */ + p_dal_isr->isr_knet(p_dal_isr->isr_knet_data); } return IRQ_HANDLED; @@ -287,19 +290,14 @@ intr1_handler(int irq, void* dev_id) disable_irq_nosync(irq); - if (p_dal_isr) + /* user mode interrupt handler */ + poll_intr_trigger[1] = 1; + wake_up(&poll_intr[1]); + + if (p_dal_isr->isr_knet) { - if (p_dal_isr->isr) - { - /* kernel mode interrupt handler */ - p_dal_isr->isr(p_dal_isr->isr_data); - } - else if ((NULL == p_dal_isr->isr) && (NULL == p_dal_isr->isr_data)) - { - /* user mode interrupt handler */ - poll_intr_trigger[1] = 1; - wake_up(&poll_intr[1]); - } + /* kernel mode interrupt handler */ + p_dal_isr->isr_knet(p_dal_isr->isr_knet_data); } return IRQ_HANDLED; @@ -315,19 +313,14 @@ intr2_handler(int irq, void* dev_id) } disable_irq_nosync(irq); - if (p_dal_isr) + /* user mode interrupt handler */ + poll_intr_trigger[2] = 1; + wake_up(&poll_intr[2]); + + if (p_dal_isr->isr_knet) { - if (p_dal_isr->isr) - { - /* kernel mode interrupt handler */ - p_dal_isr->isr(p_dal_isr->isr_data); - } - else if ((NULL == p_dal_isr->isr) && (NULL == p_dal_isr->isr_data)) - { - /* user mode interrupt handler */ - poll_intr_trigger[2] = 1; - wake_up(&poll_intr[2]); - } + /* kernel mode interrupt handler */ + p_dal_isr->isr_knet(p_dal_isr->isr_knet_data); } return IRQ_HANDLED; @@ -343,19 +336,14 @@ intr3_handler(int irq, void* dev_id) } disable_irq_nosync(irq); - if (p_dal_isr) + /* user mode interrupt handler */ + poll_intr_trigger[3] = 1; + wake_up(&poll_intr[3]); + + if (p_dal_isr->isr_knet) { - if (p_dal_isr->isr) - { - /* kernel mode interrupt handler */ - p_dal_isr->isr(p_dal_isr->isr_data); - } - else if ((NULL == p_dal_isr->isr) && (NULL == p_dal_isr->isr_data)) - { - /* user mode interrupt handler */ - poll_intr_trigger[3] = 1; - wake_up(&poll_intr[3]); - } + /* kernel mode interrupt handler */ + p_dal_isr->isr_knet(p_dal_isr->isr_knet_data); } return IRQ_HANDLED; @@ -371,21 +359,15 @@ intr4_handler(int irq, void* dev_id) } disable_irq_nosync(irq); - if (p_dal_isr) + /* user mode interrupt handler */ + poll_intr_trigger[4] = 1; + wake_up(&poll_intr[4]); + + if (p_dal_isr->isr_knet) { - if (p_dal_isr->isr) - { - /* kernel mode interrupt handler */ - p_dal_isr->isr(p_dal_isr->isr_data); - } - else if ((NULL == p_dal_isr->isr) && (NULL == p_dal_isr->isr_data)) - { - /* user mode interrupt handler */ - poll_intr_trigger[4] = 1; - wake_up(&poll_intr[4]); - } + /* kernel mode interrupt handler */ + p_dal_isr->isr_knet(p_dal_isr->isr_knet_data); } - return IRQ_HANDLED; } @@ -399,21 +381,15 @@ intr5_handler(int irq, void* dev_id) } disable_irq_nosync(irq); - if (p_dal_isr) + /* user mode interrupt handler */ + poll_intr_trigger[5] = 1; + wake_up(&poll_intr[5]); + + if (p_dal_isr->isr_knet) { - if (p_dal_isr->isr) - { - /* kernel mode interrupt handler */ - p_dal_isr->isr(p_dal_isr->isr_data); - } - else if ((NULL == p_dal_isr->isr) && (NULL == p_dal_isr->isr_data)) - { - /* user mode interrupt handler */ - poll_intr_trigger[5] = 1; - wake_up(&poll_intr[5]); - } + /* kernel mode interrupt handler */ + p_dal_isr->isr_knet(p_dal_isr->isr_knet_data); } - return IRQ_HANDLED; } @@ -427,21 +403,15 @@ intr6_handler(int irq, void* dev_id) } disable_irq_nosync(irq); - if (p_dal_isr) + /* user mode interrupt handler */ + poll_intr_trigger[6] = 1; + wake_up(&poll_intr[6]); + + if (p_dal_isr->isr_knet) { - if (p_dal_isr->isr) - { - /* kernel mode interrupt handler */ - p_dal_isr->isr(p_dal_isr->isr_data); - } - else if ((NULL == p_dal_isr->isr) && (NULL == p_dal_isr->isr_data)) - { - /* user mode interrupt handler */ - poll_intr_trigger[6] = 1; - wake_up(&poll_intr[6]); - } + /* kernel mode interrupt handler */ + p_dal_isr->isr_knet(p_dal_isr->isr_knet_data); } - return IRQ_HANDLED; } @@ -455,19 +425,14 @@ intr7_handler(int irq, void* dev_id) } disable_irq_nosync(irq); - if (p_dal_isr) + /* user mode interrupt handler */ + poll_intr_trigger[7] = 1; + wake_up(&poll_intr[7]); + + if (p_dal_isr->isr_knet) { - if (p_dal_isr->isr) - { - /* kernel mode interrupt handler */ - p_dal_isr->isr(p_dal_isr->isr_data); - } - else if ((NULL == p_dal_isr->isr) && (NULL == p_dal_isr->isr_data)) - { - /* user mode interrupt handler */ - poll_intr_trigger[7] = 1; - wake_up(&poll_intr[7]); - } + /* kernel mode interrupt handler */ + p_dal_isr->isr_knet(p_dal_isr->isr_knet_data); } return IRQ_HANDLED; @@ -660,51 +625,117 @@ dal_interrupt_set_en(unsigned int irq, unsigned int enable) } static int -_dal_set_msi_enabe(unsigned int lchip, unsigned int irq_num) +_dal_set_msi_enabe(unsigned int lchip, unsigned int irq_num, unsigned int msi_type) { int ret = 0; dal_kern_pcie_dev_t* dev = NULL; if (DAL_CPU_MODE_TYPE_PCIE == active_type[lchip]) { + unsigned int index = 0; dev = dal_dev[lchip]; if (NULL == dev) { return -1; } - if (irq_num == 1) + + if (DAL_MSI_TYPE_MSI == msi_type) { - ret = pci_enable_msi(dev->pci_dev); - if (ret) +#if 0 + if (irq_num == 1) { - printk ("msi enable failed!!! lchip = %d, irq_num = %d\n", lchip, irq_num); - pci_disable_msi(dev->pci_dev); - msi_used = 0; - } + ret = pci_enable_msi(dev->pci_dev); + if (ret) + { + printk ("msi enable failed!!! lchip = %d, irq_num = %d\n", lchip, irq_num); + pci_disable_msi(dev->pci_dev); + msi_used = 0; + } - msi_irq_base[lchip] = dev->pci_dev->irq; + msi_irq_base[lchip][0] = dev->pci_dev->irq; msi_irq_num[lchip] = 1; } else { -#if 0 -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 79)) - ret = pci_enable_msi_exact(dev->pci_dev, irq_num); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)) + ret = pci_alloc_irq_vectors(dev->pci_dev, 1, irq_num, PCI_IRQ_ALL_TYPES); +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 79)) + ret = pci_enable_msi_exact(dev->pci_dev, irq_num); #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 26, 32)) - ret = pci_enable_msi_block(dev->pci_dev, irq_num); + ret = pci_enable_msi_block(dev->pci_dev, irq_num); #else - ret = -1; + ret = -1; +#endif + if (ret) + { + printk ("msi enable failed!!! lchip = %d, irq_num = %d\n", lchip, irq_num); + pci_disable_msi(dev->pci_dev); + msi_used = 0; + } + + msi_irq_num[lchip] = irq_num; + for (index=0; indexpci_dev->irq+index; + } + + } #endif - if (ret) + ret = -1; + //ret = pci_alloc_irq_vectors(dev->pci_dev, 1, irq_num, PCI_IRQ_ALL_TYPES); + ret = pci_alloc_irq_vectors(dev->pci_dev, 1, irq_num, PCI_IRQ_MSI); + if (ret < 0) { - printk ("msi enable failed!!! lchip = %d, irq_num = %d\n", lchip, irq_num); + printk ("msi enable failed!!! lchip = %d, irq_num = %d, ret = %d\n", lchip, irq_num, ret); pci_disable_msi(dev->pci_dev); msi_used = 0; } + else + { + printk ("msi enable success!!! lchip = %d, irq_num = %d, ret = %d\n", lchip, irq_num, ret); + ret = 0; + } - msi_irq_base[lchip] = dev->pci_dev->irq; msi_irq_num[lchip] = irq_num; -#endif + for (index = 0; index < irq_num; index++) + { + msi_irq_base[lchip][index] = dev->pci_dev->irq + index; + } + } + else + { + struct msix_entry entries[CTC_MAX_INTR_NUM]; + unsigned int index = 0; + memset(entries, 0, sizeof(struct msix_entry)*CTC_MAX_INTR_NUM); + for (index = 0; index < CTC_MAX_INTR_NUM; index++) + { + entries[index].entry = index; + } + ret = pci_enable_msix_exact(dev->pci_dev, entries, irq_num); + if (ret > 0) + { + printk ("msix retrying interrupts = %d\n", ret); + ret = pci_enable_msix_exact(dev->pci_dev, entries, ret); + if (ret != 0) + { + printk ("msix enable failed!!! lchip = %d, irq_num = %d\n", lchip, irq_num); + return -1; + } + } + else if (ret < 0) + { + printk ("msix enable failed!!! lchip = %d, irq_num = %d\n", lchip, irq_num); + return -1; + } + else + { + msi_irq_num[lchip] = irq_num; + for (index=0; indexpci_dev); + if (DAL_MSI_TYPE_MSI == msi_type) + { + pci_disable_msi(dev->pci_dev); + } + else + { + pci_disable_msix(dev->pci_dev); + } - msi_irq_base[lchip] = 0; + memset(&msi_irq_base[0][0], 0, sizeof(unsigned int)*DAL_MAX_CHIP_NUM*CTC_MAX_INTR_NUM); msi_irq_num[lchip] = 0; } @@ -744,7 +782,7 @@ dal_set_msi_cap(unsigned long arg) return -EFAULT; } - printk("####dal_set_msi_cap lchip %d base %d num:%d\n", msi_info.lchip, msi_info.irq_base, msi_info.irq_num); + printk("####dal_set_msi_cap lchip %d base %d num:%d\n", msi_info.lchip, msi_info.irq_base[0], msi_info.irq_num); if (DAL_CPU_MODE_TYPE_PCIE == active_type[msi_info.lchip]) { if (msi_info.irq_num > 0) @@ -752,23 +790,23 @@ dal_set_msi_cap(unsigned long arg) if (0 == msi_used) { msi_used = 1; - ret = _dal_set_msi_enabe(msi_info.lchip, msi_info.irq_num); + ret = _dal_set_msi_enabe(msi_info.lchip, msi_info.irq_num, msi_info.msi_type); } else if ((1 == msi_used) && (msi_info.irq_num != msi_irq_num[msi_info.lchip])) { for (index = 0; index < msi_irq_num[msi_info.lchip]; index++) { - dal_interrupt_unregister(msi_irq_base[msi_info.lchip]+index); + dal_interrupt_unregister(msi_irq_base[msi_info.lchip][index]); } - _dal_set_msi_disable(msi_info.lchip); + _dal_set_msi_disable(msi_info.lchip, msi_info.msi_type); msi_used = 1; - ret = _dal_set_msi_enabe(msi_info.lchip, msi_info.irq_num); + ret = _dal_set_msi_enabe(msi_info.lchip, msi_info.irq_num, msi_info.msi_type); } } else { msi_used = 0; - ret = _dal_set_msi_disable(msi_info.lchip); + ret = _dal_set_msi_disable(msi_info.lchip, msi_info.msi_type); } } @@ -835,7 +873,6 @@ dal_user_interrupt_set_en(unsigned long arg) * 2: Part of largest contiguous segment * 3: Part of current contiguous segment */ -#ifndef DMA_MEM_MODE_PLATFORM static int _dal_find_largest_segment(dma_segment_t* dseg) { @@ -1068,7 +1105,7 @@ _dal_dma_segment_free(dma_segment_t* dseg) page_addr < dseg->blk_ptr[i] + dseg->blk_size; page_addr += PAGE_SIZE) { - MEM_MAP_UNRESERVE(VIRT_TO_PAGE(page_addr)); + MEM_MAP_UNRESERVE(VIRT_TO_PAGE((void*)page_addr)); } free_pages(dseg->blk_ptr[i], dseg->blk_order); @@ -1128,7 +1165,6 @@ _dal_pgfree(void* ptr) } return -1; } -#endif static void dal_alloc_dma_pool(int lchip, int size) @@ -1203,6 +1239,7 @@ dal_free_dma_pool(int lchip) { dev = &(((dal_kern_local_dev_t*)(dal_dev[lchip]))->pci_dev->dev); } + #endif dma_free_coherent(dev, dma_mem_size, dma_virt_base[lchip], dma_phy_base[lchip]); @@ -1215,6 +1252,14 @@ dal_free_dma_pool(int lchip) } #endif } + if (wb_virt_base[lchip]) + { + ret = _dal_pgfree(wb_virt_base[lchip]); + if(ret<0) + { + printk("free wb memory fail !!!!!! \n"); + } + } } #define _KERNEL_DAL_IO @@ -1434,8 +1479,10 @@ linux_get_device(unsigned long arg) #if defined(SOC_ACTIVE) if (DAL_CPU_MODE_TYPE_LOCAL == active_type[lchip]) { - user_dev.phy_base0 = (unsigned int)((dal_kern_pcie_dev_t*)(dal_dev[lchip]))->phys_address; - user_dev.phy_base1 = (unsigned int)(((dal_kern_pcie_dev_t*)(dal_dev[lchip]))->phys_address >> 32); + user_dev.phy_base0 = (unsigned int)((dal_kern_local_dev_t*)(dal_dev[lchip]))->phys_address; + user_dev.phy_base1 = (unsigned int)(((dal_kern_local_dev_t*)(dal_dev[lchip]))->phys_address >> 32); + user_dev.dma_phy_base0 = (unsigned int)((dal_kern_local_dev_t*)(dal_dev[lchip]))->dma_phys_address; + user_dev.dma_phy_base1 = (unsigned int)(((dal_kern_local_dev_t*)(dal_dev[lchip]))->dma_phys_address >> 32); user_dev.bus_no = 0; user_dev.dev_no = CTC_TSINGMA_DEVICE_ID; user_dev.fun_no = 0; @@ -1456,7 +1503,7 @@ linux_get_device(unsigned long arg) static int linux_get_dal_version(unsigned long arg) { - int dal_ver = VERSION_1DOT2; /* set dal version */ + int dal_ver = VERSION_1DOT4; /* set dal version */ if (copy_to_user((int*)arg, (void*)&dal_ver, sizeof(dal_ver))) { @@ -1493,11 +1540,44 @@ linux_get_dma_info(unsigned long arg) return 0; } +static int +linux_get_wb_info(unsigned long arg) +{ + dal_dma_info_t dma_para; + + if (copy_from_user(&dma_para, (void*)arg, sizeof(dal_dma_info_t))) + { + return -EFAULT; + } + + if (wb_mem_size && (0 == wb_phy_base[dma_para.lchip])) + { + /* Get wb memory from kernel */ + wb_virt_base[dma_para.lchip] = _dal_pgalloc(wb_mem_size); + wb_phy_base[dma_para.lchip] = virt_to_bus(wb_virt_base[dma_para.lchip]); + printk("wb_phy_base[lchip] 0x%llx wb_virt_base[lchip] %p \n", wb_phy_base[dma_para.lchip], wb_virt_base[dma_para.lchip]); + } + dma_para.phy_base = (unsigned int)wb_phy_base[dma_para.lchip]; + dma_para.phy_base_hi = wb_phy_base[dma_para.lchip] >> 32; + dma_para.virt_base = wb_virt_base[dma_para.lchip]; + dma_para.size = wb_mem_size; + + printk("dal dma phy addr: 0x%llx, virt addr: %p.\n", wb_phy_base[dma_para.lchip], wb_virt_base[dma_para.lchip]); + + if (copy_to_user((dal_dma_info_t*)arg, (void*)&dma_para, sizeof(dal_dma_info_t))) + { + return -EFAULT; + } + + return 0; +} + static int dal_get_msi_info(unsigned long arg) { dal_msi_info_t msi_para; unsigned int lchip = 0; + unsigned int index = 0; /* get lchip form user mode */ if (copy_from_user(&msi_para, (void*)arg, sizeof(dal_msi_info_t))) @@ -1508,14 +1588,20 @@ dal_get_msi_info(unsigned long arg) if (DAL_CPU_MODE_TYPE_PCIE == active_type[lchip]) { - msi_para.irq_base = msi_irq_base[lchip]; msi_para.irq_num = msi_irq_num[lchip]; + for (index=0; indexdma_logic_address + offset); + } +#endif + return 0; +} + +int +dal_dma_direct_write(unsigned char lchip, unsigned int offset, unsigned int value) +{ + if (!VERIFY_CHIP_INDEX(lchip)) + { + return -1; + } + + if (DAL_CPU_MODE_TYPE_LOCAL != active_type[lchip]) + { + return -1; + } + +#if defined(SOC_ACTIVE) + if (DAL_CPU_MODE_TYPE_LOCAL == active_type[lchip]) + { + *(volatile unsigned int*)(((dal_kern_local_dev_t*)(dal_dev[lchip]))->dma_logic_address + offset) = value; + } +#endif + + return 0; +} + #if defined(SOC_ACTIVE) static int linux_dal_local_probe(struct platform_device *pdev) { @@ -1631,6 +1762,7 @@ static int linux_dal_local_probe(struct platform_device *pdev) int i = 0; int irq = 0; struct resource * res = NULL; + struct resource * dma_res = NULL; printk(KERN_WARNING "********found soc dal device*****\n"); @@ -1677,6 +1809,23 @@ static int linux_dal_local_probe(struct platform_device *pdev) return PTR_ERR(dev->logic_address); } + dma_res = platform_get_resource(pdev, IORESOURCE_MEM, 1); + if (dma_res && dma_res->start) + { + dev->dma_phys_address = dma_res->start; + dev->dma_logic_address = devm_ioremap_resource(&pdev->dev, dma_res); + if (IS_ERR(dev->dma_logic_address)) + { + kfree(dev); + return PTR_ERR(dev->dma_logic_address); + } + } + else + { + dev->dma_phys_address = 0; + dev->dma_logic_address = 0; + } + for (i = 0; i < CTC_MAX_INTR_NUM; i++) { irq = platform_get_irq(pdev, i); @@ -1694,9 +1843,9 @@ static int linux_dal_local_probe(struct platform_device *pdev) _dal_pci_read(lchip, 0x48, &temp); if (((temp >> 8) & 0xffff) == 0x3412) { - printk("Little endian Cpu detected!!! \n"); _dal_pci_write(lchip, 0x48, 0xFFFFFFFF); } + printk("Little endian Cpu detected!!! \n"); /* alloc dma_mem_size for every chip */ if (dma_mem_size) @@ -1725,6 +1874,7 @@ int linux_dal_pcie_probe(struct pci_dev* pdev, const struct pci_device_id* id) unsigned int lchip = 0; int bar = 0; int ret = 0; + int endian_mode = 0; /*unsigned int devid = 0;*/ printk(KERN_WARNING "********found cpu dal device*****\n"); @@ -1763,7 +1913,7 @@ int linux_dal_pcie_probe(struct pci_dev* pdev, const struct pci_device_id* id) dev->pci_dev = pdev; - if (pdev->device == 0x5236) + if ((pdev->device == 0x5236) || (pdev->device == 0x8180)) { printk("use bar2 to config memory space\n"); bar = 2; @@ -1796,15 +1946,25 @@ int linux_dal_pcie_probe(struct pci_dev* pdev, const struct pci_device_id* id) dev->logic_address = (uintptr)ioremap_nocache(dev->phys_address, pci_resource_len(dev->pci_dev, bar)); + /*0: little endian 1: big endian*/ + endian_mode = (CTC_TSINGMA_DEVICE_ID == pdev->device)?0:1; active_type[lchip] = DAL_CPU_MODE_TYPE_PCIE; - _dal_pci_read(lchip, 0x48, &temp); if (((temp >> 8) & 0xffff) == 0x3412) { - printk("Little endian Cpu detected!!! \n"); + endian_mode = (CTC_TSINGMA_DEVICE_ID == pdev->device)?1:0; _dal_pci_write(lchip, 0x48, 0xFFFFFFFF); } + if (endian_mode) + { + printk("Big endian Cpu detected!!! \n"); + } + else + { + printk("Little endian Cpu detected!!! \n"); + } + pci_set_master(pdev); @@ -1848,6 +2008,10 @@ linux_dal_local_remove(struct platform_device *pdev) if (1 == flag) { dal_free_dma_pool(lchip); + if (wb_virt_base[lchip]) + { + _dal_pgfree(wb_virt_base[lchip]); + } dev->pci_dev = NULL; kfree(dev); dal_chip_num--; @@ -1878,6 +2042,10 @@ linux_dal_pcie_remove(struct pci_dev* pdev) if (1 == flag) { dal_free_dma_pool(lchip); + if (wb_virt_base[lchip]) + { + _dal_pgfree(wb_virt_base[lchip]); + } pci_release_regions(pdev); pci_disable_device(pdev); dev->pci_dev = NULL; @@ -1956,6 +2124,9 @@ linux_dal_ioctl(struct inode* inode, struct file* file, case CMD_CACHE_FLUSH: return dal_user_cache_flush(arg); + case CMD_GET_WB_INFO: + return linux_get_wb_info(arg); + default: break; } @@ -2231,4 +2402,6 @@ module_exit(linux_dal_exit); EXPORT_SYMBOL(dal_get_dal_ops); EXPORT_SYMBOL(dal_cache_inval); EXPORT_SYMBOL(dal_cache_flush); +EXPORT_SYMBOL(dal_dma_direct_read); +EXPORT_SYMBOL(dal_dma_direct_write); diff --git a/platform/centec/centec-dal/dal_kernel.h b/platform/centec/centec-dal/dal_kernel.h index 1055dba26952..227b2f1ea5d6 100644 --- a/platform/centec/centec-dal/dal_kernel.h +++ b/platform/centec/centec-dal/dal_kernel.h @@ -55,6 +55,7 @@ typedef unsigned int uintptr; #define DAL_DEV_NAME "/dev/" DAL_NAME #define DAL_ONE_KB 1024 #define DAL_ONE_MB (1024*1024) +#define CTC_MAX_INTR_NUM 8 struct dal_chip_parm_s { unsigned int lchip; /*tmp should be uint8*/ @@ -84,6 +85,8 @@ struct dal_user_dev_s unsigned int lchip; /*input: local chip id*/ unsigned int phy_base0; /* low 32bits physical base address */ unsigned int phy_base1; /* high 32bits physical base address */ + unsigned int dma_phy_base0; /* low 32bits physical base address */ + unsigned int dma_phy_base1; /* high 32bits physical base address */ unsigned int bus_no; unsigned int dev_no; unsigned int fun_no; @@ -100,11 +103,20 @@ struct dal_pci_cfg_ioctl_s }; typedef struct dal_pci_cfg_ioctl_s dal_pci_cfg_ioctl_t; +enum dal_msi_type_e +{ + DAL_MSI_TYPE_MSI, + DAL_MSI_TYPE_MSIX, + DAL_MSI_TYPE_MAX +}; +typedef enum dal_msi_type_e dal_msi_type_t; + struct dal_msi_info_s { unsigned int lchip; - unsigned int irq_base; + unsigned int irq_base[CTC_MAX_INTR_NUM]; unsigned int irq_num; + unsigned int msi_type; }; typedef struct dal_msi_info_s dal_msi_info_t; @@ -147,6 +159,7 @@ typedef struct dal_dma_cache_info_s dal_dma_cache_info_t; #define CMD_SET_DMA_INFO _IO(CMD_MAGIC, 21) #define CMD_REG_DMA_CHAN _IO(CMD_MAGIC, 22) #define CMD_HANDLE_NETIF _IO(CMD_MAGIC, 23) +#define CMD_GET_WB_INFO _IO(CMD_MAGIC, 24) enum dal_version_e { @@ -154,6 +167,8 @@ enum dal_version_e VERSION_1DOT0, VERSION_1DOT1, VERSION_1DOT2, + VERSION_1DOT3, + VERSION_1DOT4, VERSION_MAX }; @@ -171,7 +186,8 @@ typedef struct dal_ops_s dal_ops_t; extern int dal_get_dal_ops(dal_ops_t **dal_ops); extern int dal_cache_inval(unsigned long ptr, unsigned int length); extern int dal_cache_flush(unsigned long ptr, unsigned int length); - +extern int dal_dma_direct_read(unsigned char lchip, unsigned int offset, unsigned int* value); +extern int dal_dma_direct_write(unsigned char lchip, unsigned int offset, unsigned int value); #ifdef __cplusplus } #endif diff --git a/platform/centec/centec-dal/dal_mpool.c b/platform/centec/centec-dal/dal_mpool.c index f3b5f85e5ecd..708dcffd917b 100644 --- a/platform/centec/centec-dal/dal_mpool.c +++ b/platform/centec/centec-dal/dal_mpool.c @@ -1,9 +1,11 @@ +#ifdef CLANG +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu-designator" +#endif -/*SYSTEM MODIFIED, Added by weij for compile SDK, 2017-09-11*/ -//#include "sal.h" #include "dal_mpool.h" -#define DAL_MAX_CHIP_NUM 32 -#ifdef __KERNEL__ +#include "dal_common.h" + #include #include @@ -16,20 +18,7 @@ static spinlock_t dal_mpool_lock[DAL_MAX_CHIP_NUM]; #define MPOOL_LOCK() unsigned long flags; spin_lock_irqsave(&dal_mpool_lock[lchip], flags) #define MPOOL_UNLOCK() spin_unlock_irqrestore(&dal_mpool_lock[lchip], flags) #define DAL_PRINT(fmt,arg...) printk(fmt,##arg) -#else /* !__KERNEL__*/ - -#include -#include "sal.h" -#define DAL_MALLOC(x) sal_malloc(x) -#define DAL_FREE(x) sal_free(x) -static sal_mutex_t* dal_mpool_lock[DAL_MAX_CHIP_NUM]; -#define MPOOL_LOCK_INIT() sal_mutex_create(&dal_mpool_lock[lchip]) -#define MPOOL_LOCK_DEINIT() sal_mutex_destroy(dal_mpool_lock[lchip]) -#define MPOOL_LOCK() sal_mutex_lock(dal_mpool_lock[lchip]) -#define MPOOL_UNLOCK() sal_mutex_unlock(dal_mpool_lock[lchip]) -#define DAL_PRINT(fmt,arg...) sal_printf(fmt,##arg) - -#endif /* __KERNEL__ */ + dal_mpool_mem_t* g_free_block_ptr = NULL; /* System cache line size */ @@ -40,14 +29,12 @@ dal_mpool_mem_t* g_free_block_ptr = NULL; static dal_mpool_mem_t* p_desc_pool[DAL_MAX_CHIP_NUM] = {0}; static dal_mpool_mem_t* p_data_pool[DAL_MAX_CHIP_NUM] = {0}; -/*SYSTEM MODIFIED, Added by weij for compile SDK, 2017-09-11*/ int dal_mpool_init(uint8_t lchip) { MPOOL_LOCK_INIT(); return 0; } -/*SYSTEM MODIFIED, Added by weij for compile SDK, 2017-09-11*/ int dal_mpool_deinit(uint8_t lchip) { @@ -320,7 +307,6 @@ dal_mpool_usage(dal_mpool_mem_t* pool, int type) { int usage = 0; dal_mpool_mem_t* ptr; - /*SYSTEM MODIFIED, Added by weij for compile SDK, 2017-09-11*/ uint8_t lchip = 0; MPOOL_LOCK(); @@ -342,7 +328,6 @@ dal_mpool_debug(dal_mpool_mem_t* pool) { dal_mpool_mem_t* ptr; int index = 0; - /*SYSTEM MODIFIED, Added by weij for compile SDK, 2017-09-11*/ uint8_t lchip = 0; MPOOL_LOCK(); @@ -358,3 +343,7 @@ dal_mpool_debug(dal_mpool_mem_t* pool) return 0; } +#ifdef CLANG +#pragma clang diagnostic pop +#endif + From d9cdf9d14f035c29a97010e017d920925b63bea1 Mon Sep 17 00:00:00 2001 From: Junchao-Mellanox <57339448+Junchao-Mellanox@users.noreply.github.com> Date: Sun, 2 May 2021 23:14:56 +0800 Subject: [PATCH 008/136] [Mellanox] Adjust PSU fan name to align with sysfs file name (#7490) Change PSU fan name from psu_{psu_index}fan{fan_index} to psu{psu_index}_fan{fan_index} --- platform/mellanox/mlnx-platform-api/sonic_platform/fan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/fan.py b/platform/mellanox/mlnx-platform-api/sonic_platform/fan.py index cad7d014e0f7..98e5c40fc3df 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/fan.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/fan.py @@ -64,7 +64,7 @@ def __init__(self, fan_index, fan_drawer, position, psu_fan = False, psu=None): 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._name = 'psu{}_fan{}'.format(self.index, 1) self.fan_max_speed_path = os.path.join(CONFIG_PATH, "psu_fan_max") self.fan_min_speed_path = os.path.join(CONFIG_PATH, "psu_fan_min") self.psu_i2c_bus_path = os.path.join(CONFIG_PATH, 'psu{0}_i2c_bus'.format(self.index)) From e1ff8b6ad62010def45a1dd41d32ad26fa4225ed Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sun, 2 May 2021 09:55:15 -0700 Subject: [PATCH 009/136] [ci]: change timeout to 36 hours for armhf/arm64 build Signed-off-by: Guohan Lu --- .azure-pipelines/azure-pipelines-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/azure-pipelines-build.yml b/.azure-pipelines/azure-pipelines-build.yml index d482934f57bf..a285aae0235b 100644 --- a/.azure-pipelines/azure-pipelines-build.yml +++ b/.azure-pipelines/azure-pipelines-build.yml @@ -58,7 +58,7 @@ jobs: platform_rpc: centec - name: centec-arm64 pool: sonicbld_8c - timeoutInMinutes: 1800 + timeoutInMinutes: 2160 variables: PLATFORM_ARCH: arm64 - name: generic @@ -69,7 +69,7 @@ jobs: swi_image: yes - name: marvell-armhf pool: sonicbld_8c - timeoutInMinutes: 1800 + timeoutInMinutes: 2160 variables: PLATFORM_ARCH: armhf - name: mellanox From cfda77b3de1fc97f320213800d1523cd4809d6e5 Mon Sep 17 00:00:00 2001 From: Wirut Getbamrung Date: Mon, 3 May 2021 23:14:35 +0700 Subject: [PATCH 010/136] [device/celestica]: Add thermalctld support on Haliburton platform APIs (#6493) - Removed the old function for detecting a faulty fan. - Removed the old function for detecting excess temperature. - Implement thermal_manager APIs based on ThermalManagerBase - Implement thermal_conditions APIs based on ThermalPolicyConditionBase - Implement thermal_actions APIs based on ThermalPolicyActionBase - Implement thermal_info APIs based on ThermalPolicyInfoBase - Add thermal_policy.json --- .../x86_64-cel_e1031-r0/fancontrol-B2F | 20 +- .../x86_64-cel_e1031-r0/fancontrol-F2B | 20 +- .../sonic_platform/__init__.py | 4 +- .../sonic_platform/chassis.py | 67 +++-- .../sonic_platform/common.py | 283 ++++++++++++++++++ .../sonic_platform/component.py | 3 +- .../sonic_platform/eeprom.py | 15 +- .../x86_64-cel_e1031-r0/sonic_platform/fan.py | 81 +++-- .../x86_64-cel_e1031-r0/sonic_platform/psu.py | 1 - .../x86_64-cel_e1031-r0/sonic_platform/sfp.py | 6 +- .../sonic_platform/thermal.py | 231 ++++++++++---- .../sonic_platform/thermal_actions.py | 78 +++++ .../sonic_platform/thermal_conditions.py | 78 +++++ .../sonic_platform/thermal_infos.py | 165 ++++++++++ .../sonic_platform/thermal_manager.py | 47 +++ .../sonic_platform/watchdog.py | 3 - .../thermal_overload_control.sh | 75 +++++ .../x86_64-cel_e1031-r0/thermal_policy.json | 93 ++++++ .../debian/platform-modules-haliburton.init | 7 +- .../platform-modules-haliburton.postinst | 11 +- .../haliburton/script/fancontrol.sh | 79 ++--- 21 files changed, 1144 insertions(+), 223 deletions(-) create mode 100644 device/celestica/x86_64-cel_e1031-r0/sonic_platform/common.py create mode 100644 device/celestica/x86_64-cel_e1031-r0/sonic_platform/thermal_actions.py create mode 100644 device/celestica/x86_64-cel_e1031-r0/sonic_platform/thermal_conditions.py create mode 100644 device/celestica/x86_64-cel_e1031-r0/sonic_platform/thermal_infos.py create mode 100644 device/celestica/x86_64-cel_e1031-r0/sonic_platform/thermal_manager.py create mode 100755 device/celestica/x86_64-cel_e1031-r0/thermal_overload_control.sh create mode 100644 device/celestica/x86_64-cel_e1031-r0/thermal_policy.json diff --git a/device/celestica/x86_64-cel_e1031-r0/fancontrol-B2F b/device/celestica/x86_64-cel_e1031-r0/fancontrol-B2F index 883f3c0c899d..7c16892835d5 100644 --- a/device/celestica/x86_64-cel_e1031-r0/fancontrol-B2F +++ b/device/celestica/x86_64-cel_e1031-r0/fancontrol-B2F @@ -1,13 +1,11 @@ # Configuration file generated by pwmconfig, changes will be lost INTERVAL=2 -DEVPATH=hwmon3=devices/pci0000:00/0000:00:13.0/i2c-0/i2c-8/i2c-23/23-004d hwmon2=devices/pci0000:00/0000:00:13.0/i2c-0/i2c-8/i2c-11/11-001a -DEVNAME=hwmon3=emc2305 hwmon2=max6699 -FCTEMPS=hwmon3/device/pwm1=hwmon2/temp1_input hwmon3/device/pwm2=hwmon2/temp1_input hwmon3/device/pwm4=hwmon2/temp1_input -FCFANS=hwmon3/device/pwm1=hwmon3/device/fan1_input hwmon3/device/pwm2=hwmon3/device/fan2_input hwmon3/device/pwm4=hwmon3/device/fan4_input -MINTEMP=hwmon3/device/pwm1=27 hwmon3/device/pwm2=27 hwmon3/device/pwm4=27 -MAXTEMP=hwmon3/device/pwm1=46 hwmon3/device/pwm2=46 hwmon3/device/pwm4=46 -MINSTART=hwmon3/device/pwm1=102 hwmon3/device/pwm2=102 hwmon3/device/pwm4=102 -MINSTOP=hwmon3/device/pwm1=102 hwmon3/device/pwm2=102 hwmon3/device/pwm4=102 -MINPWM=hwmon3/device/pwm1=102 hwmon3/device/pwm2=102 hwmon3/device/pwm4=102 -MAXPWM=hwmon3/device/pwm1=255 hwmon3/device/pwm2=255 hwmon3/device/pwm4=255 -THYST=hwmon3/device/pwm1=2 hwmon3/device/pwm2=2 hwmon3/device/pwm4=2 +FCTEMPS=23-004d/pwm1=/sys/bus/i2c/devices/11-001a/hwmon/hwmon*/temp1_input 23-004d/pwm2=/sys/bus/i2c/devices/11-001a/hwmon/hwmon*/temp1_input 23-004d/pwm4=/sys/bus/i2c/devices/11-001a/hwmon/hwmon*/temp1_input +FCFANS=23-004d/pwm1=23-004d/fan1_input 23-004d/pwm2=23-004d/fan2_input 23-004d/pwm4=23-004d/fan4_input +MINTEMP=23-004d/pwm1=27 23-004d/pwm2=27 23-004d/pwm4=27 +MAXTEMP=23-004d/pwm1=46 23-004d/pwm2=46 23-004d/pwm4=46 +MINSTART=23-004d/pwm1=102 23-004d/pwm2=102 23-004d/pwm4=102 +MINSTOP=23-004d/pwm1=102 23-004d/pwm2=102 23-004d/pwm4=102 +MINPWM=23-004d/pwm1=102 23-004d/pwm2=102 23-004d/pwm4=102 +MAXPWM=23-004d/pwm1=255 23-004d/pwm2=255 23-004d/pwm4=255 +THYST=23-004d/pwm1=2 23-004d/pwm2=2 23-004d/pwm4=2 diff --git a/device/celestica/x86_64-cel_e1031-r0/fancontrol-F2B b/device/celestica/x86_64-cel_e1031-r0/fancontrol-F2B index 3be1f7e339ca..a19d510b185d 100644 --- a/device/celestica/x86_64-cel_e1031-r0/fancontrol-F2B +++ b/device/celestica/x86_64-cel_e1031-r0/fancontrol-F2B @@ -1,13 +1,11 @@ # Configuration file generated by pwmconfig, changes will be lost INTERVAL=2 -DEVPATH=hwmon3=devices/pci0000:00/0000:00:13.0/i2c-0/i2c-8/i2c-23/23-004d hwmon2=devices/pci0000:00/0000:00:13.0/i2c-0/i2c-8/i2c-11/11-001a -DEVNAME=hwmon3=emc2305 hwmon2=max6697 -FCTEMPS=hwmon3/device/pwm1=hwmon2/temp3_input hwmon3/device/pwm2=hwmon2/temp3_input hwmon3/device/pwm4=hwmon2/temp3_input -FCFANS=hwmon3/device/pwm1=hwmon3/device/fan1_input hwmon3/device/pwm2=hwmon3/device/fan2_input hwmon3/device/pwm4=hwmon3/device/fan4_input -MINTEMP=hwmon3/device/pwm1=29 hwmon3/device/pwm2=29 hwmon3/device/pwm4=29 -MAXTEMP=hwmon3/device/pwm1=46 hwmon3/device/pwm2=46 hwmon3/device/pwm4=46 -MINSTART=hwmon3/device/pwm1=102 hwmon3/device/pwm2=102 hwmon3/device/pwm4=102 -MINSTOP=hwmon3/device/pwm1=102 hwmon3/device/pwm2=102 hwmon3/device/pwm4=102 -MINPWM=hwmon3/device/pwm1=102 hwmon3/device/pwm2=102 hwmon3/device/pwm4=102 -MAXPWM=hwmon3/device/pwm1=255 hwmon3/device/pwm2=255 hwmon3/device/pwm4=255 -THYST=hwmon3/device/pwm1=2 hwmon3/device/pwm2=2 hwmon3/device/pwm4=2 +FCTEMPS=23-004d/pwm1=/sys/bus/i2c/devices/11-001a/hwmon/hwmon*/temp3_input 23-004d/pwm2=/sys/bus/i2c/devices/11-001a/hwmon/hwmon*/temp3_input 23-004d/pwm4=/sys/bus/i2c/devices/11-001a/hwmon/hwmon*/temp3_input +FCFANS=23-004d/pwm1=23-004d/fan1_input 23-004d/pwm2=23-004d/fan2_input 23-004d/pwm4=23-004d/fan4_input +MINTEMP=23-004d/pwm1=29 23-004d/pwm2=29 23-004d/pwm4=29 +MAXTEMP=23-004d/pwm1=46 23-004d/pwm2=46 23-004d/pwm4=46 +MINSTART=23-004d/pwm1=102 23-004d/pwm2=102 23-004d/pwm4=102 +MINSTOP=23-004d/pwm1=102 23-004d/pwm2=102 23-004d/pwm4=102 +MINPWM=23-004d/pwm1=102 23-004d/pwm2=102 23-004d/pwm4=102 +MAXPWM=23-004d/pwm1=255 23-004d/pwm2=255 23-004d/pwm4=255 +THYST=23-004d/pwm1=2 23-004d/pwm2=2 23-004d/pwm4=2 diff --git a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/__init__.py b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/__init__.py index d82f3749319c..db1748e44d2c 100644 --- a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/__init__.py +++ b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/__init__.py @@ -1,2 +1,2 @@ -__all__ = ["platform", "chassis"] -from sonic_platform import * +from . import chassis +from . import platform diff --git a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/chassis.py b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/chassis.py index b6e2dea0f67c..de7a246b43f8 100644 --- a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/chassis.py +++ b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/chassis.py @@ -6,18 +6,12 @@ # ############################################################################# -import sys -import re -import os -import subprocess -import json - try: + import sys from sonic_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper from sonic_platform_base.chassis_base import ChassisBase - from sonic_py_common import device_info + from .common import Common from .event import SfpEvent - from .helper import APIHelper except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -38,11 +32,10 @@ class Chassis(ChassisBase): def __init__(self): ChassisBase.__init__(self) - self._api_helper = APIHelper() + self._api_common = Common() self.sfp_module_initialized = False self.__initialize_eeprom() - self.is_host = self._api_helper.is_host() - + self.is_host = self._api_common.is_host() if not self.is_host: self.__initialize_fan() @@ -81,8 +74,9 @@ def __initialize_fan(self): def __initialize_thermals(self): from sonic_platform.thermal import Thermal + airflow = self.__get_air_flow() for index in range(0, NUM_THERMAL): - thermal = Thermal(index) + thermal = Thermal(index, airflow) self._thermal_list.append(thermal) def __initialize_eeprom(self): @@ -95,17 +89,11 @@ def __initialize_components(self): component = Component(index) self._component_list.append(component) - 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_air_flow(self): + air_flow_path = '/usr/share/sonic/device/{}/fan_airflow'.format( + self._api_common.platform) if self.is_host else '/usr/share/sonic/platform/fan_airflow' + air_flow = self._api_common.read_txt_file(air_flow_path) + return air_flow or 'B2F' def get_base_mac(self): """ @@ -116,6 +104,14 @@ def get_base_mac(self): """ return self._eeprom.get_mac() + 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.get_serial() + def get_system_eeprom_info(self): """ Retrieves the full content of system EEPROM information for the chassis @@ -141,7 +137,7 @@ def get_reboot_cause(self): reboot_cause = self.REBOOT_CAUSE_HARDWARE_OTHER hw_reboot_cause = self._component_list[0].get_register_value( RESET_REGISTER) - sw_reboot_cause = self.__read_txt_file( + sw_reboot_cause = self._api_common.read_txt_file( self._reboot_cause_path) or "Unknown" if hw_reboot_cause == "0x55": @@ -151,8 +147,12 @@ def get_reboot_cause(self): reboot_cause = self.REBOOT_CAUSE_POWER_LOSS elif hw_reboot_cause == "0x33": reboot_cause = self.REBOOT_CAUSE_WATCHDOG + elif hw_reboot_cause == "0x88": + reboot_cause = self.REBOOT_CAUSE_THERMAL_OVERLOAD_CPU + elif hw_reboot_cause == "0x99": + reboot_cause = self.REBOOT_CAUSE_THERMAL_OVERLOAD_ASIC else: - reboot_cause = self.REBOOT_CAUSE_HARDWARE_OTHER + reboot_cause = self.REBOOT_CAUSE_NON_HARDWARE description = 'Unknown reason' return (reboot_cause, description) @@ -251,6 +251,14 @@ def get_sfp(self, index): index, len(self._sfp_list))) return sfp + ############################################################## + ################## ThermalManager methods #################### + ############################################################## + + def get_thermal_manager(self): + from .thermal_manager import ThermalManager + return ThermalManager + ############################################################## ###################### Device methods ######################## ############################################################## @@ -261,13 +269,13 @@ def get_name(self): Returns: string: The name of the device """ - return self._api_helper.hwsku + return self._api_common.hwsku def get_presence(self): """ - Retrieves the presence of the Chassis + Retrieves the presence of the PSU Returns: - bool: True if Chassis is present, False if not + bool: True if PSU is present, False if not """ return True @@ -285,7 +293,7 @@ def get_serial(self): Returns: string: Serial number of device """ - return self._eeprom.get_serial() + return self.get_serial_number() def get_status(self): """ @@ -294,3 +302,4 @@ def get_status(self): A boolean value, True if device is operating properly, False if not """ return True + diff --git a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/common.py b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/common.py new file mode 100644 index 000000000000..84fcafd1bcf0 --- /dev/null +++ b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/common.py @@ -0,0 +1,283 @@ +import os +import imp +import yaml +import subprocess + +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' + + OUTPUT_SOURCE_IPMI = 'ipmitool' + OUTPUT_SOURCE_GIVEN_LIST = 'value_list' + OUTPUT_SOURCE_GIVEN_VALUE = 'value' + OUTPUT_SOURCE_GIVEN_CLASS = 'class' + OUTPUT_SOURCE_SYSFS = 'sysfs_value' + OUTPUT_SOURCE_FUNC = 'function' + OUTPUT_SOURCE_GIVEN_TXT_FILE = 'txt_file' + OUTPUT_SOURCE_GIVEN_VER_HEX_FILE = 'hex_version_file' + OUTPUT_SOURCE_GIVEN_VER_HEX_ADDR = 'hex_version_getreg' + + SET_METHOD_IPMI = 'ipmitool' + NULL_VAL = 'N/A' + HOST_CHK_CMD = "docker > /dev/null 2>&1" + REF_KEY = '$ref:' + + def __init__(self, conf=None): + self._main_conf = conf + (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() + + def run_command(self, command): + status = False + output = "" + try: + p = subprocess.Popen( + command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + raw_data, err = p.communicate() + if err == '': + status, output = True, raw_data.strip() + except Exception: + pass + return status, output + + def _clean_input(self, input, config): + cleaned_input = input + + ai = config.get('avaliable_input') + if ai and input not in ai: + return None + + input_translator = config.get('input_translator') + if type(input_translator) is dict: + cleaned_input = input_translator.get(input) + + elif type(input_translator) is str: + cleaned_input = eval(input_translator.format(input)) + + return cleaned_input + + def _clean_output(self, index, output, config): + output_translator = config.get('output_translator') + + if type(output_translator) is dict: + output = output_translator.get(output) + elif type(output_translator) is str: + output = eval(output_translator.format(output)) + elif type(output_translator) is list: + output = eval(output_translator[index].format(output)) + + return output + + def _ipmi_get(self, index, config): + argument = config.get('argument') + cmd = config['command'].format( + config['argument'][index]) if argument else config['command'] + status, output = self.run_command(cmd) + return output if status else None + + def _sysfs_read(self, index, config): + sysfs_path = config.get('sysfs_path') + argument = config.get('argument', '') + + if self.REF_KEY in argument: + argument = self._main_conf[argument.split(":")[1]] + + if type(argument) is list: + sysfs_path = sysfs_path.format(argument[index]) + + content = "" + try: + content = open(sysfs_path) + content = content.readline().rstrip() + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + + return content + + def _sysfs_write(self, index, config, input): + sysfs_path = config.get('sysfs_path') + argument = config.get('argument', '') + + if self.REF_KEY in argument: + argument = self._main_conf[argument.split(":")[1]] + + if type(argument) is list: + sysfs_path = sysfs_path.format(argument[index]) + + write_offset = int(config.get('write_offset', 0)) + output = "" + try: + open_file = open(sysfs_path, "r+") + open_file.seek(write_offset) + open_file.write(input) + open_file.close() + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False, output + return True, output + + def _ipmi_set(self, index, config, input): + arg = config['argument'][index].format(input) + return self.run_command(config['command'].format(arg)) + + def _hex_ver_decode(self, hver, num_of_bits, num_of_points): + ver_list = [] + c_bit = 0 + bin_val = bin(int(hver, 16))[2:].zfill(num_of_bits) + bit_split = num_of_bits / (num_of_points + 1) + for x in range(0, num_of_points+1): + split_bin = bin_val[c_bit:c_bit+bit_split] + ver_list.append(str(int(split_bin, 2))) + c_bit += bit_split + return '.'.join(ver_list) + + def _get_class(self, config): + """ + Retreives value of expected attribute + Returns: + A value of the attribute of object + """ + path = config['host_path'] if self.is_host() else config['pmon_path'] + module = imp.load_source(config['class'], path) + class_ = getattr(module, config['class']) + return class_ + + def get_reg(self, path, reg_addr): + cmd = "echo {1} > {0}; cat {0}".format(path, reg_addr) + status, output = self.run_command(cmd) + return output if status else None + + def read_txt_file(self, path): + with open(path, 'r') as f: + output = f.readline() + return output.strip('\n') + + 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 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) + + def get_output(self, index, config, default): + """ + Retrieves the output for each function base on config + + Args: + index: An integer containing the index of device. + config: A dict object containing the configuration of specified function. + default: A string containing the default output of specified function. + + Returns: + A string containing the output of specified function in config + """ + output_source = config.get('output_source') + + if output_source == self.OUTPUT_SOURCE_IPMI: + output = self._ipmi_get(index, config) + + elif output_source == self.OUTPUT_SOURCE_GIVEN_VALUE: + output = config["value"] + + elif output_source == self.OUTPUT_SOURCE_GIVEN_CLASS: + output = self._get_class(config) + + elif output_source == self.OUTPUT_SOURCE_GIVEN_LIST: + output = config["value_list"][index] + + elif output_source == self.OUTPUT_SOURCE_SYSFS: + output = self._sysfs_read(index, config) + + elif output_source == self.OUTPUT_SOURCE_FUNC: + func_conf = self._main_conf[config['function'][index]] + output = self.get_output(index, func_conf, default) + + elif output_source == self.OUTPUT_SOURCE_GIVEN_TXT_FILE: + path = config.get('path') + output = self.read_txt_file(path) + + elif output_source == self.OUTPUT_SOURCE_GIVEN_VER_HEX_FILE: + path = config.get('path') + hex_ver = self.read_txt_file(path) + output = self._hex_ver_decode( + hex_ver, config['num_of_bits'], config['num_of_points']) + + elif output_source == self.OUTPUT_SOURCE_GIVEN_VER_HEX_ADDR: + path = config.get('path') + addr = config.get('reg_addr') + hex_ver = self.get_reg(path, addr) + output = self._hex_ver_decode( + hex_ver, config['num_of_bits'], config['num_of_points']) + + else: + output = default + + return self._clean_output(index, output, config) or default + + def set_output(self, index, input, config): + """ + Sets the output of specified function on config + + Args: + config: A dict object containing the configuration of specified function. + index: An integer containing the index of device. + input: A string containing the input of specified function. + + Returns: + bool: True if set function is successfully, False if not + """ + cleaned_input = self._clean_input(input, config) + if not cleaned_input: + return False + + set_method = config.get('set_method') + if set_method == self.SET_METHOD_IPMI: + output = self._ipmi_set(index, config, cleaned_input)[0] + elif set_method == self.OUTPUT_SOURCE_SYSFS: + output = self._sysfs_write(index, config, cleaned_input)[0] + else: + output = False + + return output + + def get_event(self, timeout, config, sfp_list): + """ + Returns a nested dictionary containing all devices which have + experienced a change at chassis level + + """ + event_class = self._get_class(config) + return event_class(sfp_list).get_event(timeout) diff --git a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/component.py b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/component.py index 7fdfc8756a4d..8d2829f90c01 100644 --- a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/component.py +++ b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/component.py @@ -6,7 +6,6 @@ # ############################################################################# -import json import os.path import shutil import shlex @@ -49,7 +48,7 @@ def __run_command(self, command): rc = process.poll() if rc != 0: return False - except: + except Exception: return False return True 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 0058fccfa0ca..c31d29f2caef 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 @@ -8,11 +8,9 @@ ############################################################################# try: - import glob import os import sys import re - from array import array if sys.version_info.major == 3: from io import StringIO @@ -52,7 +50,7 @@ def __parse_output(self, decode_output): value = match.group(3).rstrip('\0') _eeprom_info_dict[idx] = value - except: + except Exception: pass return _eeprom_info_dict @@ -61,7 +59,7 @@ def _load_eeprom(self): sys.stdout = StringIO() try: self.read_eeprom_db() - except: + except Exception: decode_output = sys.stdout.getvalue() sys.stdout = original_stdout return self.__parse_output(decode_output) @@ -73,7 +71,7 @@ def _load_eeprom(self): if not os.path.exists(CACHE_ROOT): try: os.makedirs(CACHE_ROOT) - except: + except Exception: pass # @@ -82,7 +80,7 @@ def _load_eeprom(self): # try: self.set_cache_name(os.path.join(CACHE_ROOT, CACHE_FILE)) - except: + except Exception: pass e = self.read_eeprom() @@ -91,7 +89,7 @@ def _load_eeprom(self): try: self.update_cache(e) - except: + except Exception: pass self.decode_eeprom(e) @@ -112,3 +110,6 @@ def get_serial(self): def get_mac(self): return self._eeprom.get('0x24', "Undefined.") + + def get_pn(self): + return self._eeprom.get('0x21', "Undefined.") diff --git a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/fan.py b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/fan.py index cebed613db92..c066cb9c33fc 100644 --- a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/fan.py +++ b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/fan.py @@ -6,12 +6,12 @@ # ############################################################################# -import json import math import os.path try: from sonic_platform_base.fan_base import FanBase + from .common import Common except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -67,24 +67,9 @@ def __init__(self, fan_tray_index, fan_index=0, is_psu_fan=False, psu_index=0): self.STATUS_LED_COLOR_RED: "amber", self.STATUS_LED_COLOR_OFF: "off" } - 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: - return False - return True + self._api_common = Common() + FanBase.__init__(self) def __search_file_by_name(self, directory, file_name): for dirpath, dirnames, files in os.walk(directory): @@ -105,7 +90,8 @@ def get_direction(self): if not self.is_psu_fan: fan_direction_file = (FAN_PATH + self.fan_e1031_direction.format(self.fan_tray_index+1)) - raw = self.__read_txt_file(fan_direction_file).strip('\r\n') + raw = self._api_common.read_txt_file( + fan_direction_file).strip('\r\n') direction = self.FAN_DIRECTION_INTAKE if str( raw).upper() == "F2B" else self.FAN_DIRECTION_EXHAUST @@ -126,8 +112,8 @@ def get_speed(self): fan_speed_sysfs_name = "fan{}_input".format(self.fan_index+1) fan_speed_sysfs_path = self.__search_file_by_name( self.psu_hwmon_path, fan_speed_sysfs_name) - fan_speed_rpm = self.__read_txt_file(fan_speed_sysfs_path) or 0 - fan_speed_raw = float(fan_speed_rpm)/PSU_FAN_MAX_RPM * 100 + fan_speed_rpm = self._api_common.read_txt_file( + fan_speed_sysfs_path) or 0 speed = math.ceil(float(fan_speed_rpm) * 100 / PSU_FAN_MAX_RPM) elif self.get_presence(): chip = self.emc2305_chip_mapping[self.fan_index] @@ -136,7 +122,7 @@ def get_speed(self): sysfs_path = "%s%s/%s" % ( EMC2305_PATH, device, EMC2305_FAN_INPUT) sysfs_path = sysfs_path.format(fan_index[self.fan_tray_index]) - raw = self.__read_txt_file(sysfs_path).strip('\r\n') + raw = self._api_common.read_txt_file(sysfs_path).strip('\r\n') pwm = int(raw, 10) if raw else 0 speed = math.ceil(float(pwm * 100 / EMC2305_MAX_PWM)) @@ -163,7 +149,7 @@ def get_target_speed(self): sysfs_path = "%s%s/%s" % ( EMC2305_PATH, device, EMC2305_FAN_TARGET) sysfs_path = sysfs_path.format(fan_index[self.fan_tray_index]) - raw = self.__read_txt_file(sysfs_path).strip('\r\n') + raw = self._api_common.read_txt_file(sysfs_path).strip('\r\n') pwm = int(raw, 10) if raw else 0 target = math.ceil(float(pwm) * 100 / EMC2305_MAX_PWM) @@ -202,7 +188,7 @@ def set_speed(self, speed): sysfs_path = "%s%s/%s" % ( EMC2305_PATH, device, EMC2305_FAN_PWM) sysfs_path = sysfs_path.format(fan_index[self.fan_tray_index]) - return self.__write_txt_file(sysfs_path, int(pwm)) + return self._api_common.write_txt_file(sysfs_path, int(pwm)) return False @@ -220,7 +206,7 @@ def set_status_led(self, color): fan_led_file = (FAN_PATH + self.fan_e1031_led.format(self.fan_tray_index+1)) - set_status_led = self.__write_txt_file( + set_status_led = self._api_common.write_txt_file( fan_led_file, self.fan_e1031_led_col_map[color]) if self.get_presence() else False return set_status_led @@ -244,14 +230,55 @@ def get_presence(self): """ fan_direction_file = (FAN_PATH + self.fan_e1031_presence.format(self.fan_tray_index+1)) - present_str = self.__read_txt_file(fan_direction_file) or '1' + present_str = self._api_common.read_txt_file(fan_direction_file) or '1' return int(present_str) == 0 if not self.is_psu_fan else True + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + if self.is_psu_fan: + return NULL_VAL + + model = NULL_VAL + return model + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + if self.is_psu_fan: + return NULL_VAL + + serial = NULL_VAL + return 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.get_presence() and self.get_speed() > 0 \ No newline at end of file + status = 1 + if self.is_psu_fan: + fan_fault_sysfs_name = "fan1_fault" + fan_fault_sysfs_path = self.__search_file_by_name( + self.psu_hwmon_path, fan_fault_sysfs_name) + status = self._api_common.read_txt_file(fan_fault_sysfs_path) + + elif self.get_presence(): + chip = self.emc2305_chip_mapping[self.fan_index] + device = chip['device'] + fan_index = chip['index_map'] + sysfs_path = "%s%s/%s" % ( + EMC2305_PATH, device, 'fan{}_fault') + sysfs_path = sysfs_path.format(fan_index[self.fan_tray_index]) + status = self._api_common.read_txt_file(sysfs_path) + + return False if int(status) != 0 else True + diff --git a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/psu.py b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/psu.py index 27d70f123c59..ccc63c8ac9ae 100644 --- a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/psu.py +++ b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/psu.py @@ -7,7 +7,6 @@ ############################################################################# import os.path -import sonic_platform try: from sonic_platform_base.psu_base import PsuBase 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 36ee9cbc01a0..91e5fec65ffc 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 @@ -8,7 +8,6 @@ import os import time -import subprocess from ctypes import create_string_buffer try: @@ -159,7 +158,7 @@ def __read_eeprom_specific_bytes(self, offset, num_bytes): raw = sysfsfile_eeprom.read(num_bytes) for n in range(0, num_bytes): eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) - except: + except Exception: pass finally: if sysfsfile_eeprom: @@ -469,7 +468,6 @@ def get_tx_disable(self): A Boolean, True if tx_disable is enabled, False if disabled """ tx_disable = False - tx_fault = False status_control_raw = self.__read_eeprom_specific_bytes( SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) if status_control_raw: @@ -602,7 +600,7 @@ def tx_disable(self, tx_disable): # Write to eeprom sysfsfile_eeprom.seek(SFP_STATUS_CONTROL_OFFSET) sysfsfile_eeprom.write(buffer[0]) - except: + except Exception: #print("Error: unable to open file: %s" % str(e)) return False finally: diff --git a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/thermal.py b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/thermal.py index 6c73845287cd..2235b4c6572a 100644 --- a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/thermal.py +++ b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/thermal.py @@ -6,16 +6,90 @@ # ############################################################################# -import os -import re -import os.path - try: + import os from sonic_platform_base.thermal_base import ThermalBase + from .common import Common except ImportError as e: raise ImportError(str(e) + "- required module not found") +THERMAL_INFO = { + 0: { + "F2B_max": 55.000, + "F2B_max_crit": 58.000, + "B2F_max": 55.000, + "B2F_max_crit": 58.000, + "postion": "asic", + "name": "Inlet ambient sensor (Rear to Front)", + "ss_index": 1, + "i2c_path": "i2c-11/11-001a/hwmon", # U7273 + }, + 1: { + "F2B_max": 85.000, + "F2B_max_crit": 90.000, + "B2F_max": 85.000, + "B2F_max_crit": 90.000, + "postion": "asic", + "name": "Helix shutdown sensor (Rear to Front)", + "ss_index": 2, + "i2c_path": "i2c-11/11-001a/hwmon", # Q7000 + }, + 2: { + "F2B_max": 55.000, + "F2B_max_crit": 58.000, + "B2F_max": 55.000, + "B2F_max_crit": 58.000, + "postion": "asic", + "name": "Inlet ambient sensor (Front to Rear, right)", + "ss_index": 3, + "i2c_path": "i2c-11/11-001a/hwmon", # Q7001 + }, + 3: { + "F2B_max": 85.000, + "F2B_max_crit": 90.000, + "B2F_max": 85.000, + "B2F_max_crit": 90.000, + "postion": "asic", + "name": "Helix shutdown sensor (Front to Rear)", + "ss_index": 4, + "i2c_path": "i2c-11/11-001a/hwmon", # Q7751 + }, + 4: { + "F2B_max": 55.000, + "F2B_max_crit": 58.000, + "B2F_max": 55.000, + "B2F_max_crit": 58.000, + "postion": "cpu", + "name": "Inlet ambient sensor (Front to Rear, left)", + "ss_index": 5, + "i2c_path": "i2c-11/11-001a/hwmon" # Q7752 + }, + 5: { + "F2B_max": 90.000, + "F2B_max_crit": 95.000, + "B2F_max": 90.000, + "B2F_max_crit": 95.000, + "postion": "cpu", + "name": "CPU errata sensor (Front to Rear)", + "ss_index": 2, + "i2c_path": "i2c-3/3-001a/hwmon" # Q5 + }, + 6: { + "F2B_max": 90.000, + "F2B_max_crit": 95.000, + "B2F_max": 90.000, + "B2F_max_crit": 95.000, + "postion": "cpu", + "name": "CPU errata sensor (Rear to Front)", + "ss_index": 3, + "i2c_path": "i2c-3/3-001a/hwmon" # Q6 + } +} +NULL_VAL = "N/A" +I2C_ADAPTER_PATH = "/sys/class/i2c-adapter" + + class Thermal(ThermalBase): """Platform-specific Thermal class""" @@ -24,57 +98,33 @@ class Thermal(ThermalBase): CPUBOARD_SS_PATH = "/sys/class/i2c-adapter/i2c-3/3-001a/hwmon/hwmon1" SS_CONFIG_PATH = "/usr/share/sonic/device/x86_64-cel_e1031-r0/sensors.conf" - def __init__(self, thermal_index): + def __init__(self, thermal_index, airflow): ThermalBase.__init__(self) - self.index = thermal_index + self._api_common = Common() + + self._airflow = airflow + self._thermal_info = THERMAL_INFO[self.index] + self._hwmon_path = self._get_hwmon_path() + self._ss_index = self._thermal_info["ss_index"] - # Add thermal name - self.THERMAL_NAME_LIST.append("Rear panel-Inlet ambient sensor") - self.THERMAL_NAME_LIST.append("Rear panel-Helix shutdown sensor") - self.THERMAL_NAME_LIST.append( - "Front panel-Inlet ambient sensor (right)") - self.THERMAL_NAME_LIST.append("Front panel-Helix shutdown sensor") - self.THERMAL_NAME_LIST.append( - "Front panel-Inlet ambient sensor (left)") - self.THERMAL_NAME_LIST.append("CPU board temperature sensor : 1") - self.THERMAL_NAME_LIST.append("CPU board temperature sensor : 2") - - # Set hwmon path - self.ss_index, self.hwmon_path = self.__get_ss_info(self.index) - self.ss_key = self.THERMAL_NAME_LIST[self.index] - - def __get_ss_info(self, index): - if self.index <= 4: - ss_path = self.MAINBOARD_SS_PATH - ss_index = index+1 - else: - ss_path = self.CPUBOARD_SS_PATH - ss_index = index-3 - return ss_index, ss_path - - 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) + self.name = self.get_name() + self.postion = self._thermal_info["postion"] + + def _get_hwmon_path(self): + hwmon_path = os.path.join(I2C_ADAPTER_PATH, self._thermal_info["i2c_path"]) + hwmon_dir = os.listdir(hwmon_path)[0] + return os.path.join(hwmon_path, hwmon_dir) + + def _get_temp(self, temp_file): + temp_file_path = os.path.join(self._hwmon_path, temp_file) + raw_temp = self._api_common.read_txt_file(temp_file_path) temp = float(raw_temp)/1000 - return "{:.3f}".format(temp) + 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 _set_threshold(self, file_name, temperature): + temp_file_path = os.path.join(self._hwmon_path, file_name) + return self._api_common.write_txt_file(temp_file_path, str(temperature)) def get_temperature(self): """ @@ -83,8 +133,8 @@ 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) - return self.__get_temp(temp_file) + temp_file = "temp{}_input".format(self._ss_index) + return self._get_temp(temp_file) def get_high_threshold(self): """ @@ -93,8 +143,17 @@ 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 """ - temp_file = "temp{}_max".format(self.ss_index) - return self.__get_temp(temp_file) + max_crit_key = '{}_max'.format(self._airflow) + return self._thermal_info.get(max_crit_key, 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 + """ + return 0.0 def set_high_threshold(self, temperature): """ @@ -105,8 +164,8 @@ def set_high_threshold(self, temperature): Returns: A boolean, True if threshold is set successfully, False if not """ - temp_file = "temp{}_max".format(self.ss_index) - is_set = self.__set_threshold(temp_file, int(temperature*1000)) + temp_file = "temp{}_max".format(self._ss_index) + is_set = self._set_threshold(temp_file, int(temperature*1000)) file_set = False if is_set: try: @@ -115,7 +174,7 @@ def set_high_threshold(self, temperature): f.seek(0) ss_found = False for idx, val in enumerate(content): - if self.ss_key in val: + if self.name in val: ss_found = True elif ss_found and temp_file in val: content[idx] = " set {} {}\n".format( @@ -128,13 +187,43 @@ def set_high_threshold(self, temperature): return is_set & file_set + 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 + """ + max_crit_key = '{}_max_crit'.format(self._airflow) + return self._thermal_info.get(max_crit_key, 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 + """ + return 0.0 + 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] + return self._thermal_info["name"] def get_presence(self): """ @@ -142,10 +231,26 @@ def get_presence(self): 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) + 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_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return NULL_VAL + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return NULL_VAL + def get_status(self): """ Retrieves the operational status of the device @@ -155,10 +260,10 @@ def get_status(self): if not self.get_presence(): return False - fault_file = "temp{}_fault".format(self.ss_index) - fault_file_path = os.path.join(self.hwmon_path, fault_file) + fault_file = "temp{}_fault".format(self._ss_index) + fault_file_path = os.path.join(self._hwmon_path, fault_file) if not os.path.isfile(fault_file_path): return True - raw_txt = self.__read_txt_file(fault_file_path) + raw_txt = self._api_common.read_txt_file(fault_file_path) return int(raw_txt) == 0 diff --git a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/thermal_actions.py b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/thermal_actions.py new file mode 100644 index 000000000000..75307d291496 --- /dev/null +++ b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/thermal_actions.py @@ -0,0 +1,78 @@ +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_infos import ChassisInfo +from .common import Common + + +@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: + """ + if ChassisInfo.INFO_NAME in thermal_info_dict: + chassis_info_obj = thermal_info_dict[ChassisInfo.INFO_NAME] + chassis = chassis_info_obj.get_chassis() + thermal_manager = chassis.get_thermal_manager() + if self.status: + thermal_manager.start_thermal_control_algorithm() + else: + thermal_manager.stop_thermal_control_algorithm() + + +@thermal_json_object('switch.power_cycling') +class SwitchPolicyAction(ThermalPolicyActionBase): + """ + Base class for thermal action. Once all thermal conditions in a thermal policy are matched, + all predefined thermal action will be executed. + """ + + def execute(self, thermal_info_dict): + """ + Take action when thermal condition matches. For example, power cycle the switch. + :param thermal_info_dict: A dictionary stores all thermal information. + :return: + """ + thermal_overload_position_path = '/tmp/thermal_overload_position' + thermal_overload_position = Common().read_txt_file( + thermal_overload_position_path) + + cmd = 'bash /usr/share/sonic/platform/thermal_overload_control.sh {}'.format( + thermal_overload_position) + Common().run_command(cmd) diff --git a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/thermal_conditions.py b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/thermal_conditions.py new file mode 100644 index 000000000000..ea7b759211fb --- /dev/null +++ b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/thermal_conditions.py @@ -0,0 +1,78 @@ +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.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.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.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_threshold') +class ThermalOverHighCriticalCondition(ThermalCondition): + def is_match(self, thermal_info_dict): + thermal_info_obj = self.get_thermal_info(thermal_info_dict) + if thermal_info_obj: + return thermal_info_obj.is_over_high_threshold() + else: + return False + + +@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) + if thermal_info_obj: + return thermal_info_obj.is_over_high_critical_threshold() + else: + return False + + +@thermal_json_object('thermal.all.good') +class ThermalGoodCondition(ThermalCondition): + def is_match(self, thermal_info_dict): + thermal_info_obj = self.get_thermal_info(thermal_info_dict) + if thermal_info_obj: + return not thermal_info_obj.is_over_threshold() + else: + return False diff --git a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/thermal_infos.py b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/thermal_infos.py new file mode 100644 index 000000000000..c493ceb655bc --- /dev/null +++ b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/thermal_infos.py @@ -0,0 +1,165 @@ +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 +from .common import Common +import time + + +@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._status_changed = False + + def collect(self, chassis): + """ + Collect absence and presence fans. + :param chassis: The chassis object + :return: + """ + 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._status_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._status_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_status_changed(self): + """ + Retrieves if the status of fan information changed + :return: True if status changed else False + """ + return self._status_changed + + +@thermal_json_object('thermal_info') +class ThermalInfo(ThermalPolicyInfoBase): + """ + Thermal information needed by thermal policy + """ + + # Fan information name + INFO_NAME = 'thermal_info' + + def collect(self, chassis): + """ + Collect thermal sensor temperature change status + :param chassis: The chassis object + :return: + """ + self._over_high_threshold = False + self._over_high_critical_threshold = False + self._thermal_overload_position = 'cpu' + + # Calculate average temp within the device + temp = 0 + num_of_thermals = chassis.get_num_thermals() + for index in range(num_of_thermals): + thermal = chassis.get_thermal(index) + temp = thermal.get_temperature() + high_threshold = thermal.get_high_threshold() + high_critical_threshold = thermal.get_high_critical_threshold() + + if high_threshold and temp > high_threshold: + self._over_high_threshold = True + + if high_critical_threshold and temp > high_critical_threshold: + self._thermal_overload_position = thermal.postion + self._over_high_critical_threshold = True + + def is_over_threshold(self): + """ + Retrieves if the temperature is over any threshold + :return: True if the temperature is over any threshold else False + """ + return self._over_high_threshold or self._over_high_critical_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 + """ + thermal_overload_position_path = '/tmp/thermal_overload_position' + if self._over_high_critical_threshold: + Common().write_txt_file(thermal_overload_position_path, + self._thermal_overload_position) + time.sleep(1) + return self._over_high_critical_threshold + + 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 + + +@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/device/celestica/x86_64-cel_e1031-r0/sonic_platform/thermal_manager.py b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/thermal_manager.py new file mode 100644 index 000000000000..2e379f8c2a2d --- /dev/null +++ b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/thermal_manager.py @@ -0,0 +1,47 @@ +from sonic_platform_base.sonic_thermal_control.thermal_manager_base import ThermalManagerBase +from .common import Common +from .thermal_actions import * +from .thermal_conditions import * +from .thermal_infos import * + + +class ThermalManager(ThermalManagerBase): + FSC_ALGORITHM_CMD = ' supervisorctl {} fancontrol' + + @classmethod + def start_thermal_control_algorithm(cls): + """ + Start vendor specific thermal control algorithm. The default behavior of this function is a no-op. + :return: + """ + return cls._enable_fancontrol_service(True) + + @classmethod + def stop_thermal_control_algorithm(cls): + """ + Stop thermal control algorithm + Returns: + bool: True if set success, False if fail. + """ + return cls._enable_fancontrol_service(False) + + @classmethod + def deinitialize(cls): + """ + Destroy thermal manager, including any vendor specific cleanup. The default behavior of this function + is a no-op. + :return: + """ + return cls._enable_fancontrol_service(True) + + @classmethod + def _enable_fancontrol_service(cls, enable): + """ + Control thermal by fcs algorithm + Args: + enable: Bool, indicate enable the algorithm or not + Returns: + bool: True if set success, False if fail. + """ + cmd = 'start' if enable else 'stop' + return Common().run_command(cls.FSC_ALGORITHM_CMD.format(cmd)) diff --git a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/watchdog.py b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/watchdog.py index 6db0508cb845..62f325655cac 100644 --- a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/watchdog.py +++ b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/watchdog.py @@ -4,11 +4,8 @@ # Watchdog contains an implementation of SONiC Platform Base API # ############################################################################# -import ctypes import fcntl import os -import subprocess -import time import array try: diff --git a/device/celestica/x86_64-cel_e1031-r0/thermal_overload_control.sh b/device/celestica/x86_64-cel_e1031-r0/thermal_overload_control.sh new file mode 100755 index 000000000000..67ca9b9a2e66 --- /dev/null +++ b/device/celestica/x86_64-cel_e1031-r0/thermal_overload_control.sh @@ -0,0 +1,75 @@ +#!/bin/bash +# +# Copyright 2020-present Celestica. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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. +# +# + +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin +SETREG_FILE=/sys/devices/platform/e1031.smc/setreg +TOVERREG=0x115 +CPUOVER=0xa1 +ASICOVER=0xa2 + +prog="$0" +command="$1" + +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root" + exit 1 +fi + +usage() { + echo "Usage: thermal_overload_control.sh [option] " + echo + echo "Options:" + echo " -h, --help : to print this message." + echo + echo "Commands:" + echo + echo " cpu: To enabling CPU thermal overload handler" + echo + echo " asic : To enabling ASIC thermal overload handler" + echo +} + +cpu_overload() { + logger "Enable CPU thermal overload control" + set_reg=`echo ${TOVERREG} ${CPUOVER} > ${SETREG_FILE}` +} + +asic_overload() { + logger "Enable ASIC thermal overload control" + set_reg=`echo ${TOVERREG} ${ASICOVER} > ${SETREG_FILE}` +} + +if [ $# -lt 1 ]; then + usage + exit -1 +fi + +case "$command" in +-h | --help) + usage + ;; +cpu) + cpu_overload + ;; +asic) + asic_overload + ;; +*) + usage + exit -1 + ;; +esac + +exit $? diff --git a/device/celestica/x86_64-cel_e1031-r0/thermal_policy.json b/device/celestica/x86_64-cel_e1031-r0/thermal_policy.json new file mode 100644 index 000000000000..276fede0b044 --- /dev/null +++ b/device/celestica/x86_64-cel_e1031-r0/thermal_policy.json @@ -0,0 +1,93 @@ +{ + "thermal_control_algorithm": { + "run_at_boot_up": "true" + }, + "info_types": [ + { + "type": "chassis_info" + }, + { + "type": "fan_info" + }, + { + "type": "thermal_info" + } + ], + "policies": [ + { + "name": "any fan absence", + "conditions": [ + { + "type": "fan.any.absence" + } + ], + "actions": [ + { + "type": "thermal_control.control", + "status": "false" + } + ] + }, + { + "name": "any fan broken", + "conditions": [ + { + "type": "fan.any.fault" + } + ], + "actions": [ + { + "type": "thermal_control.control", + "status": "false" + } + ] + }, + { + "name": "any thermal over threshold", + "conditions": [ + { + "type": "thermal.over.high_threshold" + } + ], + "actions": [ + { + "type": "thermal_control.control", + "status": "false" + } + ] + }, + { + "name": "temp over high critical threshold", + "conditions": [ + { + "type": "thermal.over.high_critical_threshold" + } + ], + "actions": [ + { + "type": "switch.power_cycling" + } + ] + }, + { + "name": "all fan presence / thermal no warning", + "conditions": [ + { + "type": "fan.all.presence" + }, + { + "type": "fan.all.good" + }, + { + "type": "thermal.all.good" + } + ], + "actions": [ + { + "type": "thermal_control.control", + "status": "true" + } + ] + } + ] +} \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.init b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.init index 80964d5338af..5c73be6ee50c 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.init +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.init @@ -53,9 +53,12 @@ start) echo max6699 0x1a > /sys/bus/i2c/devices/i2c-3/new_device echo max6699 0x1a > /sys/bus/i2c/devices/i2c-11/new_device + ## TODO: fix dps200 driver cause kernel panic issue + # https://github.com/Azure/sonic-buildimage/issues/6602 + # Attach PSUs - echo dps200 0x5a > /sys/bus/i2c/devices/i2c-12/new_device - echo dps200 0x5b > /sys/bus/i2c/devices/i2c-13/new_device + # echo dps200 0x5a > /sys/bus/i2c/devices/i2c-12/new_device + # echo dps200 0x5b > /sys/bus/i2c/devices/i2c-13/new_device # Attach fans echo emc2305 0x4d > /sys/bus/i2c/devices/i2c-23/new_device diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.postinst b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.postinst index 1ebafb7fdabb..57ac1be34152 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.postinst +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.postinst @@ -1,12 +1,15 @@ depmod -a + sudo chmod +x /usr/local/bin/udev_prefix.sh sudo chmod +x /usr/local/bin/popmsg.sh sudo chmod +x /usr/local/bin/reload_udev.sh + +/usr/local/bin/platform_api_mgnt.sh install +/etc/init.d/fancontrol.sh install +/usr/local/bin/reload_udev.sh + systemctl enable platform-modules-haliburton.service systemctl enable fancontrol.service systemctl start platform-modules-haliburton.service -systemctl start fancontrol.service - -/usr/local/bin/platform_api_mgnt.sh install -/usr/local/bin/reload_udev.sh +systemctl start fancontrol.service \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-cel/haliburton/script/fancontrol.sh b/platform/broadcom/sonic-platform-modules-cel/haliburton/script/fancontrol.sh index f2c0f3cd0f4e..03617a1fad36 100755 --- a/platform/broadcom/sonic-platform-modules-cel/haliburton/script/fancontrol.sh +++ b/platform/broadcom/sonic-platform-modules-cel/haliburton/script/fancontrol.sh @@ -7,72 +7,37 @@ # Default-Start: 2 3 4 5 # Default-Stop: # Short-Description: fancontrol -# Description: fan speed regulator +# Description: fancontrol configuration selector ### END INIT INFO . /lib/lsb/init-functions [ -f /etc/default/rcS ] && . /etc/default/rcS -PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin -DAEMON=/usr/local/bin/fancontrol -DESC="fan speed regulator" -NAME="fancontrol" -PIDFILE=/var/run/fancontrol.pid -PLATFORMPATH=/sys/devices/platform/e1031.smc MAIN_CONF=/usr/share/sonic/device/x86_64-cel_e1031-r0/fancontrol -DEVPATH=/sys/devices/pci0000:00/0000:00:13.0/i2c-0/i2c-8/i2c-23/23-004d +PLATFORM_PATH=/sys/devices/platform/e1031.smc -test -x $DAEMON || exit 0 +init() { + FANDIR=$(cat ${PLATFORM_PATH}/fan1_dir) + CONF=${MAIN_CONF}-${FANDIR} + echo $FANDIR > /usr/share/sonic/device/x86_64-cel_e1031-r0/fan_airflow +} -for i in 1 2 3 -do - j=$i - [ $i -eq 3 ] && j=4 - FANFAULT=$(cat ${DEVPATH}/fan${j}_fault) - [ $FANFAULT = 1 ] && continue - FANDIR=$(cat ${PLATFORMPATH}/fan${i}_dir) -done -CONF=${MAIN_CONF}-${FANDIR} +install() { + find /var/lib/docker/overlay*/ -path */sbin/fancontrol -exec cp /usr/local/bin/fancontrol {} \; +} case "$1" in - start) - if [ -f $CONF ] ; then - if $DAEMON --check $CONF 1>/dev/null 2>/dev/null ; then - log_daemon_msg "Starting $DESC" "$NAME\n" - start-stop-daemon --start --quiet --pidfile $PIDFILE --startas $DAEMON $CONF - log_end_msg $? - else - log_failure_msg "Not starting fancontrol, broken configuration file; please re-run pwmconfig." - fi - else - if [ "$VERBOSE" != no ]; then - log_warning_msg "Not starting fancontrol; run pwmconfig first." - fi - fi - ;; - stop) - log_daemon_msg "Stopping $DESC" "$NAME" - start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo --startas $DAEMON $CONF - rm -f $PIDFILE - log_end_msg $? - ;; - restart) - $0 stop - sleep 3 - $0 start - ;; - force-reload) - if start-stop-daemon --stop --test --quiet --pidfile $PIDFILE --startas $DAEMON $CONF ; then - $0 restart - fi - ;; - status) - status_of_proc $DAEMON $NAME $CONF && exit 0 || exit $? - ;; - *) - log_success_msg "Usage: /etc/init.d/fancontrol {start|stop|restart|force-reload|status}" - exit 1 - ;; +start) + init + cp $CONF $MAIN_CONF + ;; +install) + install + ;; +*) + log_success_msg "Usage: /etc/init.d/fancontrol {start} | {install}" + exit 1 + ;; esac -exit 0 \ No newline at end of file +exit 0 From 6f85908d4f2c5342b159a47edbb55e7dafae89bf Mon Sep 17 00:00:00 2001 From: trzhang-msft Date: Mon, 3 May 2021 10:51:26 -0700 Subject: [PATCH 011/136] dhcpmon: support dual tor scenario (#7471) --- src/dhcpmon/src/dhcp_device.c | 12 +++++------ src/dhcpmon/src/dhcp_device.h | 19 +++++++++++++---- src/dhcpmon/src/dhcp_devman.c | 39 ++++++++++++++++++++++++++++++++++- src/dhcpmon/src/dhcp_devman.h | 11 ++++++++++ src/dhcpmon/src/main.c | 11 ++++++++-- 5 files changed, 79 insertions(+), 13 deletions(-) diff --git a/src/dhcpmon/src/dhcp_device.c b/src/dhcpmon/src/dhcp_device.c index f5cb705ee285..f45483f8504c 100644 --- a/src/dhcpmon/src/dhcp_device.c +++ b/src/dhcpmon/src/dhcp_device.c @@ -130,7 +130,7 @@ static void handle_dhcp_option_53(dhcp_device_context_t *context, case DHCP_MESSAGE_TYPE_INFORM: giaddr = ntohl(dhcphdr[DHCP_GIADDR_OFFSET] << 24 | dhcphdr[DHCP_GIADDR_OFFSET + 1] << 16 | dhcphdr[DHCP_GIADDR_OFFSET + 2] << 8 | dhcphdr[DHCP_GIADDR_OFFSET + 3]); - if ((context->vlan_ip == giaddr && context->is_uplink && dir == DHCP_TX) || + 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[DHCP_COUNTERS_CURRENT][dir][dhcp_option[2]]++; aggregate_dev.counters[DHCP_COUNTERS_CURRENT][dir][dhcp_option[2]]++; @@ -140,7 +140,7 @@ static void handle_dhcp_option_53(dhcp_device_context_t *context, case DHCP_MESSAGE_TYPE_OFFER: case DHCP_MESSAGE_TYPE_ACK: case DHCP_MESSAGE_TYPE_NAK: - if ((context->vlan_ip == iphdr->ip_dst.s_addr && context->is_uplink && dir == DHCP_RX) || + if ((context->giaddr_ip == iphdr->ip_dst.s_addr && context->is_uplink && dir == DHCP_RX) || (!context->is_uplink && dir == DHCP_TX)) { context->counters[DHCP_COUNTERS_CURRENT][dir][dhcp_option[2]]++; aggregate_dev.counters[DHCP_COUNTERS_CURRENT][dir][dhcp_option[2]]++; @@ -438,7 +438,7 @@ static int init_socket(dhcp_device_context_t *context, const char *intf) * * @return 0 on success, otherwise for failure */ -static int initialize_intf_mac_and_ip_addr(dhcp_device_context_t *context) +int initialize_intf_mac_and_ip_addr(dhcp_device_context_t *context) { int rv = -1; @@ -543,14 +543,14 @@ int dhcp_device_init(dhcp_device_context_t **context, const char *intf, uint8_t } /** - * @code dhcp_device_start_capture(context, snaplen, base, vlan_ip); + * @code dhcp_device_start_capture(context, snaplen, base, giaddr_ip); * * @brief starts packet capture on this interface */ int dhcp_device_start_capture(dhcp_device_context_t *context, size_t snaplen, struct event_base *base, - in_addr_t vlan_ip) + in_addr_t giaddr_ip) { int rv = -1; @@ -565,7 +565,7 @@ int dhcp_device_start_capture(dhcp_device_context_t *context, break; } - context->vlan_ip = vlan_ip; + context->giaddr_ip = giaddr_ip; context->buffer = (uint8_t *) malloc(snaplen); if (context->buffer == NULL) { diff --git a/src/dhcpmon/src/dhcp_device.h b/src/dhcpmon/src/dhcp_device.h index 133b9265a434..aa686f4e2718 100644 --- a/src/dhcpmon/src/dhcp_device.h +++ b/src/dhcpmon/src/dhcp_device.h @@ -73,7 +73,7 @@ typedef struct int sock; /** Raw socket associated with this device/interface */ in_addr_t ip; /** network address of this device (interface) */ uint8_t mac[ETHER_ADDR_LEN]; /** hardware address of this device (interface) */ - in_addr_t vlan_ip; /** Vlan IP address */ + in_addr_t giaddr_ip; /** Gateway IP address */ uint8_t is_uplink; /** north interface? */ char intf[IF_NAMESIZE]; /** device (interface) name */ uint8_t *buffer; /** buffer used to read socket data */ @@ -82,6 +82,17 @@ typedef struct /** current/snapshot counters of DHCP packets */ } dhcp_device_context_t; +/** + * @code initialize_intf_mac_and_ip_addr(context); + * + * @brief initializes device (interface) mac/ip addresses + * + * @param context pointer to device (interface) context + * + * @return 0 on success, otherwise for failure + */ +int initialize_intf_mac_and_ip_addr(dhcp_device_context_t *context); + /** * @code dhcp_device_get_ip(context, ip); * @@ -119,21 +130,21 @@ int dhcp_device_init(dhcp_device_context_t **context, uint8_t is_uplink); /** - * @code dhcp_device_start_capture(context, snaplen, base, vlan_ip); + * @code dhcp_device_start_capture(context, snaplen, base, giaddr_ip); * * @brief starts packet capture on this interface * * @param context pointer to device (interface) context * @param snaplen length of packet capture * @param base pointer to libevent base - * @param vlan_ip vlan IP address + * @param giaddr_ip gateway IP address * * @return 0 on success, otherwise for failure */ int dhcp_device_start_capture(dhcp_device_context_t *context, size_t snaplen, struct event_base *base, - in_addr_t vlan_ip); + in_addr_t giaddr_ip); /** * @code dhcp_device_shutdown(context); diff --git a/src/dhcpmon/src/dhcp_devman.c b/src/dhcpmon/src/dhcp_devman.c index 35378a631ca7..65484798dbd6 100644 --- a/src/dhcpmon/src/dhcp_devman.c +++ b/src/dhcpmon/src/dhcp_devman.c @@ -37,6 +37,12 @@ static uint32_t dhcp_num_mgmt_intf = 0; * This IP is used to filter Offer/Ack packet coming from DHCP server */ static in_addr_t vlan_ip = 0; +/* Device loopback interface ip, which will be used as the giaddr in dual tor setup. */ +static in_addr_t loopback_ip = 0; + +/* Whether the device is in dual tor mode, 0 as default for single tor mode. */ +static int dual_tor_mode = 0; + /** mgmt interface */ static struct intf *mgmt_intf = NULL; @@ -148,6 +154,37 @@ int dhcp_devman_add_intf(const char *name, char intf_type) return rv; } +/** + * @code dhcp_devman_setup_dual_tor_mode(name); + * + * @brief set up dual tor mode: 1) set dual_tor_mode flag and 2) retrieve loopback_ip. + */ +int dhcp_devman_setup_dual_tor_mode(const char *name) +{ + int rv = -1; + + dhcp_device_context_t loopback_intf_context; + + if (strlen(name) < sizeof(loopback_intf_context.intf)) { + strncpy(loopback_intf_context.intf, name, sizeof(loopback_intf_context.intf) - 1); + loopback_intf_context.intf[sizeof(loopback_intf_context.intf) - 1] = '\0'; + } else { + syslog(LOG_ALERT, "loopback interface name (%s) is too long", name); + return rv; + } + + if (initialize_intf_mac_and_ip_addr(&loopback_intf_context) == 0 && + dhcp_device_get_ip(&loopback_intf_context, &loopback_ip) == 0) { + dual_tor_mode = 1; + } else { + syslog(LOG_ALERT, "failed to retrieve ip addr for loopback interface (%s)", name); + return rv; + } + + rv = 0; + return rv; +} + /** * @code dhcp_devman_start_capture(snaplen, base); * @@ -160,7 +197,7 @@ int dhcp_devman_start_capture(size_t snaplen, struct event_base *base) if ((dhcp_num_south_intf == 1) && (dhcp_num_north_intf >= 1)) { LIST_FOREACH(int_ptr, &intfs, entry) { - rv = dhcp_device_start_capture(int_ptr->dev_context, snaplen, base, vlan_ip); + rv = dhcp_device_start_capture(int_ptr->dev_context, snaplen, base, dual_tor_mode ? loopback_ip : vlan_ip); if (rv == 0) { syslog(LOG_INFO, "Capturing DHCP packets on interface %s, ip: 0x%08x, mac [%02x:%02x:%02x:%02x:%02x:%02x] \n", diff --git a/src/dhcpmon/src/dhcp_devman.h b/src/dhcpmon/src/dhcp_devman.h index bba7076902cb..948e79cde4f4 100644 --- a/src/dhcpmon/src/dhcp_devman.h +++ b/src/dhcpmon/src/dhcp_devman.h @@ -63,6 +63,17 @@ dhcp_device_context_t* dhcp_devman_get_mgmt_dev(); */ int dhcp_devman_add_intf(const char *name, char intf_type); +/** + * @code dhcp_devman_setup_dual_tor_mode(name); + * + * @brief set up dual tor mode: 1) set dual_tor_mode flag and 2) retrieve loopback_ip. + * + * @param name interface name + * + * @return 0 on success, nonzero otherwise + */ +int dhcp_devman_setup_dual_tor_mode(const char *name); + /** * @code dhcp_devman_start_capture(snaplen, base); * diff --git a/src/dhcpmon/src/main.c b/src/dhcpmon/src/main.c index bb8c45867f66..29bc534accf0 100644 --- a/src/dhcpmon/src/main.c +++ b/src/dhcpmon/src/main.c @@ -40,11 +40,12 @@ static const uint32_t dhcpmon_default_unhealthy_max_count = 10; */ static void usage(const char *prog) { - printf("Usage: %s -id {-iu }+ -im [-w ]" - "[-c ] [-s ] [-d]\n", prog); + printf("Usage: %s -id {-iu }+ -im [-u ]" + "[-w ] [-c ] [-s ] [-d]\n", prog); printf("where\n"); printf("\tsouth interface: is a vlan interface,\n"); printf("\tnorth interface: is a TOR-T1 interface,\n"); + printf("\tloopback interface: is the loopback interface for dual tor setup,\n"); printf("\tsnapshot window: during which DHCP counters are gathered and DHCP status is validated (default %d),\n", dhcpmon_default_health_check_window); printf("\tunhealthy status count: count of consecutive unhealthy status before writing an alert to syslog " @@ -132,6 +133,12 @@ int main(int argc, char **argv) } i += 2; break; + case 'u': + if (dhcp_devman_setup_dual_tor_mode(argv[i + 1]) != 0) { + usage(basename(argv[0])); + } + i += 2; + break; case 'd': make_daemon = 1; i++; From 4f2b54e7358a4581601391e8e83cd73fe4b13991 Mon Sep 17 00:00:00 2001 From: trzhang-msft Date: Mon, 3 May 2021 10:51:34 -0700 Subject: [PATCH 012/136] dhcpmon: support dual tor in docker template (#7470) --- dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 b/dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 index e6558312f6fe..a1811226a885 100644 --- a/dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 +++ b/dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 @@ -132,6 +132,8 @@ dhcpmon-{{ vlan_name }} [program:dhcpmon-{{ vlan_name }}] {# We treat this VLAN as a downstream interface (-id), as we only want to listen for requests #} command=/usr/sbin/dhcpmon -id {{ vlan_name }} +{#- Dual ToR Option #} +{% if 'subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' %} -u Loopback0{% endif -%} {#- We treat all other interfaces as upstream interfaces (-iu), as we only want to listen for replies #} {% for (name, prefix) in VLAN_INTERFACE|pfx_filter %} {% if prefix | ipv4 and name != vlan_name %} -iu {{ name }}{% endif -%} From 5ac048f7e70cedd4669ec2160338f8806a1a930d Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Tue, 4 May 2021 03:22:13 +0800 Subject: [PATCH 013/136] [Mellanox] Enhance the platform.json with adding more platform device facts. (#7495) #### Why I did it Current platform.json lacks some peripheral device related facts, like chassis/fan/pasu/drawer/thermal/components names, numbers, etc. #### How I did it Add platform device facts to the platform.json file Signed-off-by: Kebo Liu --- .../x86_64-mlnx_msn2010-r0/platform.json | 249 ++++++ .../x86_64-mlnx_msn2100-r0/platform.json | 201 +++++ .../x86_64-mlnx_msn2410-r0/platform.json | 568 ++++++++++++++ .../x86_64-mlnx_msn2700-r0/platform.json | 4 +- .../x86_64-mlnx_msn2740-r0/platform.json | 624 +++++++++++++++ .../x86_64-mlnx_msn3420-r0/platform.json | 614 +++++++++++++++ .../x86_64-mlnx_msn3700-r0/platform.json | 407 ++++++++++ .../x86_64-mlnx_msn3700c-r0/platform.json | 379 +++++++++ .../x86_64-mlnx_msn3800-r0/platform.json | 720 ++++++++++++++++++ .../x86_64-mlnx_msn4410-r0/platform.json | 407 ++++++++++ .../x86_64-mlnx_msn4600-r0/platform.json | 621 +++++++++++++++ .../x86_64-mlnx_msn4600c-r0/platform.json | 615 +++++++++++++++ .../x86_64-mlnx_msn4700-r0/platform.json | 407 ++++++++++ 13 files changed, 5814 insertions(+), 2 deletions(-) create mode 100644 device/mellanox/x86_64-mlnx_msn2740-r0/platform.json diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/platform.json b/device/mellanox/x86_64-mlnx_msn2010-r0/platform.json index 937ba5075c06..f4d5b7bcbfad 100644 --- a/device/mellanox/x86_64-mlnx_msn2010-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/platform.json @@ -1,4 +1,253 @@ { + "chassis": { + "name": "MSN2010", + "components": [ + { + "name": "ONIE" + }, + { + "name": "SSD" + }, + { + "name": "BIOS" + }, + { + "name": "CPLD1" + }, + { + "name": "CPLD2" + } + ], + "fans": [], + "fan_drawers": [ + { + "name": "N/A", + "fans": [ + { + "name": "fan1" + }, + { + "name": "fan2" + }, + { + "name": "fan3" + }, + { + "name": "fan4" + } + ] + } + ], + "psus": [ + { + "name": "PSU 1" + }, + { + "name": "PSU 2" + } + ], + "thermals": [ + { + "name": "ASIC" + }, + { + "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" + } + ], + "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" + } + ] + } + ] + }, "interfaces": { "Ethernet0": { "index": "1", diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/platform.json b/device/mellanox/x86_64-mlnx_msn2100-r0/platform.json index a6d664a61807..74b4397759c1 100644 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/platform.json @@ -1,4 +1,205 @@ { + "chassis": { + "name": "MSN2100", + "components": [ + { + "name": "ONIE" + }, + { + "name": "SSD" + }, + { + "name": "BIOS" + }, + { + "name": "CPLD1" + }, + { + "name": "CPLD2" + } + ], + "fans": [], + "fan_drawers": [ + { + "name": "N/A", + "fans": [ + { + "name": "fan1" + }, + { + "name": "fan2" + }, + { + "name": "fan3" + }, + { + "name": "fan4" + } + ] + } + ], + "psus": [ + { + "name": "PSU 1" + }, + { + "name": "PSU 2" + } + ], + "thermals": [ + { + "name": "ASIC" + }, + { + "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" + } + ], + "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" + } + ] + } + ] + }, "interfaces": { "Ethernet0": { "index": "1,1,1,1", diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/platform.json b/device/mellanox/x86_64-mlnx_msn2410-r0/platform.json index 5624ef60d49a..f0e6f6f320ad 100644 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/platform.json @@ -1,4 +1,572 @@ { + "chassis": { + "name": "MSN2410", + "components": [ + { + "name": "ONIE" + }, + { + "name": "SSD" + }, + { + "name": "BIOS" + }, + { + "name": "CPLD1" + }, + { + "name": "CPLD2" + }, + { + "name": "CPLD3" + } + ], + "fans": [], + "fan_drawers": [ + { + "name": "drawer1", + "fans": [ + { + "name": "fan1" + }, + { + "name": "fan2" + } + ] + }, + { + "name": "drawer2", + "fans": [ + { + "name": "fan3" + }, + { + "name": "fan4" + } + ] + }, + { + "name": "drawer3", + "fans": [ + { + "name": "fan5" + }, + { + "name": "fan6" + } + ] + }, + { + "name": "drawer4", + "fans": [ + { + "name": "fan7" + }, + { + "name": "fan8" + } + ] + } + ], + "psus": [ + { + "name": "PSU 1", + "fans": [ + { + "name": "psu_1_fan_1" + } + ], + "thermals": [ + { + "name": "PSU-1 Temp" + } + ] + }, + { + "name": "PSU 2", + "fans": [ + { + "name": "psu_2_fan_1" + } + ], + "thermals": [ + { + "name": "PSU-2 Temp" + } + ] + } + ], + "thermals": [ + { + "name": "ASIC" + }, + { + "name": "Ambient Fan Side Temp" + }, + { + "name": "Ambient Port Side Temp" + }, + { + "name": "CPU Core 0 Temp" + }, + { + "name": "CPU Core 1 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" + } + ] + } + ] + }, "interfaces": { "Ethernet0": { "index": "1", diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/platform.json b/device/mellanox/x86_64-mlnx_msn2700-r0/platform.json index e5ec0b2f3ca0..4cf282b46cf9 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/platform.json @@ -86,12 +86,12 @@ "name": "PSU 2", "fans": [ { - "name": "PSU-2 Temp" + "name": "psu_2_fan_1" } ], "thermals": [ { - "name": "xSFP module 1 Temp" + "name": "PSU-2 Temp" } ] } diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/platform.json b/device/mellanox/x86_64-mlnx_msn2740-r0/platform.json new file mode 100644 index 000000000000..33821ad83bd9 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/platform.json @@ -0,0 +1,624 @@ +{ + "chassis": { + "name": "MSN2740", + "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": "psu_1_fan_1" + } + ], + "thermals": [ + { + "name": "PSU-1 Temp" + } + ] + }, + { + "name": "PSU 2", + "fans": [ + { + "name": "psu_2_fan_1" + } + ], + "thermals": [ + { + "name": "PSU-2 Temp" + } + ] + } + ], + "thermals": [ + { + "name": "ASIC" + }, + { + "name": "Ambient Fan Side Temp" + }, + { + "name": "Ambient Port Side Temp" + }, + { + "name": "CPU Core 0 Temp" + }, + { + "name": "CPU Core 1 Temp" + }, + { + "name": "CPU Core 3 Temp" + }, + { + "name": "CPU Core 4 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" + } + ] + } + ] + }, + "interfaces": { + "Ethernet0": { + "index": "1,1,1,1", + "lanes": "0,1,2,3", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp1"], + "2x50G[40G,25G,10G]": ["etp1a", "etp1b"] + } + }, + "Ethernet4": { + "index": "2,2,2,2", + "lanes": "4,5,6,7", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp2"], + "2x50G[40G,25G,10G]": ["etp2a", "etp2b"] + } + }, + "Ethernet8": { + "index": "3,3,3,3", + "lanes": "8,9,10,11", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp3"], + "2x50G[40G,25G,10G]": ["etp3a", "etp3b"] + } + }, + "Ethernet12": { + "index": "4,4,4,4", + "lanes": "12,13,14,15", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp4"], + "2x50G[40G,25G,10G]": ["etp4a", "etp4b"] + } + }, + "Ethernet16": { + "index": "5,5,5,5", + "lanes": "16,17,18,19", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp5"], + "2x50G[40G,25G,10G]": ["etp5a", "etp5b"] + } + }, + "Ethernet20": { + "index": "6,6,6,6", + "lanes": "20,21,22,23", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp6"], + "2x50G[40G,25G,10G]": ["etp6a", "etp6b"] + } + }, + "Ethernet24": { + "index": "7,7,7,7", + "lanes": "24,25,26,27", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp7"], + "2x50G[40G,25G,10G]": ["etp7a", "etp7b"] + } + }, + "Ethernet28": { + "index": "8,8,8,8", + "lanes": "28,29,30,31", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp8"], + "2x50G[40G,25G,10G]": ["etp8a", "etp8b"] + } + }, + "Ethernet32": { + "index": "9,9,9,9", + "lanes": "32,33,34,35", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp9"], + "2x50G[40G,25G,10G]": ["etp9a", "etp9b"] + } + }, + "Ethernet36": { + "index": "10,10,10,10", + "lanes": "36,37,38,39", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp10"], + "2x50G[40G,25G,10G]": ["etp10a", "etp10b"] + } + }, + "Ethernet40": { + "index": "11,11,11,11", + "lanes": "40,41,42,43", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp11"], + "2x50G[40G,25G,10G]": ["etp11a", "etp11b"] + } + }, + "Ethernet44": { + "index": "12,12,12,12", + "lanes": "44,45,46,47", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp12"], + "2x50G[40G,25G,10G]": ["etp12a", "etp12b"] + } + }, + "Ethernet48": { + "index": "13,13,13,13", + "lanes": "48,49,50,51", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp13"], + "2x50G[40G,25G,10G]": ["etp13a", "etp13b"] + } + }, + "Ethernet52": { + "index": "14,14,14,14", + "lanes": "52,53,54,55", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp14"], + "2x50G[40G,25G,10G]": ["etp14a", "etp14b"] + } + }, + "Ethernet56": { + "index": "15,15,15,15", + "lanes": "56,57,58,59", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp15"], + "2x50G[40G,25G,10G]": ["etp15a", "etp15b"] + } + }, + "Ethernet60": { + "index": "16,16,16,16", + "lanes": "60,61,62,63", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp16"], + "2x50G[40G,25G,10G]": ["etp16a", "etp16b"] + } + }, + "Ethernet64": { + "index": "17,17,17,17", + "lanes": "64,65,66,67", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp17"], + "2x50G[40G,25G,10G]": ["etp17a", "etp17b"] + } + }, + "Ethernet68": { + "index": "18,18,18,18", + "lanes": "68,69,70,71", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp18"], + "2x50G[40G,25G,10G]": ["etp18a", "etp18b"] + } + }, + "Ethernet72": { + "index": "19,19,19,19", + "lanes": "72,73,74,75", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp19"], + "2x50G[40G,25G,10G]": ["etp19a", "etp19b"] + } + }, + "Ethernet76": { + "index": "20,20,20,20", + "lanes": "76,77,78,79", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp20"], + "2x50G[40G,25G,10G]": ["etp20a", "etp20b"] + } + }, + "Ethernet80": { + "index": "21,21,21,21", + "lanes": "80,81,82,83", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp21"], + "2x50G[40G,25G,10G]": ["etp21a", "etp21b"] + } + }, + "Ethernet84": { + "index": "22,22,22,22", + "lanes": "84,85,86,87", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp22"], + "2x50G[40G,25G,10G]": ["etp22a", "etp22b"] + } + }, + "Ethernet88": { + "index": "23,23,23,23", + "lanes": "88,89,90,91", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp23"], + "2x50G[40G,25G,10G]": ["etp23a", "etp23b"] + } + }, + "Ethernet92": { + "index": "24,24,24,24", + "lanes": "92,93,94,95", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp24"], + "2x50G[40G,25G,10G]": ["etp24a", "etp24b"] + } + }, + "Ethernet96": { + "index": "25,25,25,25", + "lanes": "96,97,98,99", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp25"], + "2x50G[40G,25G,10G]": ["etp25a", "etp25b"] + } + }, + "Ethernet100": { + "index": "26,26,26,26", + "lanes": "100,101,102,103", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp26"], + "2x50G[40G,25G,10G]": ["etp26a", "etp26b"] + } + }, + "Ethernet104": { + "index": "27,27,27,27", + "lanes": "104,105,106,107", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp27"], + "2x50G[40G,25G,10G]": ["etp27a", "etp27b"] + } + }, + "Ethernet108": { + "index": "28,28,28,28", + "lanes": "108,109,110,111", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp28"], + "2x50G[40G,25G,10G]": ["etp28a", "etp28b"] + } + }, + "Ethernet112": { + "index": "29,29,29,29", + "lanes": "112,113,114,115", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp29"], + "2x50G[40G,25G,10G]": ["etp29a", "etp29b"] + } + }, + "Ethernet116": { + "index": "30,30,30,30", + "lanes": "116,117,118,119", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp30"], + "2x50G[40G,25G,10G]": ["etp30a", "etp30b"] + } + }, + "Ethernet120": { + "index": "31,31,31,31", + "lanes": "120,121,122,123", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp31"], + "2x50G[40G,25G,10G]": ["etp31a", "etp31b"] + } + }, + "Ethernet124": { + "index": "32,32,32,32", + "lanes": "124,125,126,127", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp32"], + "2x50G[40G,25G,10G]": ["etp32a", "etp32b"] + } + } + } +} diff --git a/device/mellanox/x86_64-mlnx_msn3420-r0/platform.json b/device/mellanox/x86_64-mlnx_msn3420-r0/platform.json index da8df3b25cb7..339e40e79fd4 100644 --- a/device/mellanox/x86_64-mlnx_msn3420-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn3420-r0/platform.json @@ -1,4 +1,618 @@ { + "chassis": { + "name": "MSN3420", + "components": [ + { + "name": "ONIE" + }, + { + "name": "SSD" + }, + { + "name": "BIOS" + }, + { + "name": "CPLD1" + }, + { + "name": "CPLD2" + }, + { + "name": "CPLD3" + } + ], + "fans": [], + "fan_drawers": [ + { + "name": "drawer1", + "fans": [ + { + "name": "fan1" + }, + { + "name": "fan2" + } + ] + }, + { + "name": "drawer2", + "fans": [ + { + "name": "fan3" + }, + { + "name": "fan4" + } + ] + }, + { + "name": "drawer3", + "fans": [ + { + "name": "fan5" + }, + { + "name": "fan6" + } + ] + }, + { + "name": "drawer4", + "fans": [ + { + "name": "fan7" + }, + { + "name": "fan8" + } + ] + }, + { + "name": "drawer5", + "fans": [ + { + "name": "fan9" + }, + { + "name": "fan10" + } + ] + } + ], + "psus": [ + { + "name": "PSU 1", + "fans": [ + { + "name": "psu_1_fan_1" + } + ], + "thermals": [ + { + "name": "PSU-1 Temp" + } + ] + }, + { + "name": "PSU 2", + "fans": [ + { + "name": "psu_2_fan_1" + } + ], + "thermals": [ + { + "name": "PSU-2 Temp" + } + ] + } + ], + "thermals": [ + { + "name": "ASIC" + }, + { + "name": "Ambient Fan Side Temp" + }, + { + "name": "Ambient Port Side Temp" + }, + { + "name": "Ambient COMEX Temp" + }, + { + "name": "CPU Core 0 Temp" + }, + { + "name": "CPU Core 1 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" + } + ] + } + ] + }, "interfaces": { "Ethernet0": { "index": "1", diff --git a/device/mellanox/x86_64-mlnx_msn3700-r0/platform.json b/device/mellanox/x86_64-mlnx_msn3700-r0/platform.json index 1ab03932bb13..36ee7fac87c5 100644 --- a/device/mellanox/x86_64-mlnx_msn3700-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn3700-r0/platform.json @@ -1,4 +1,411 @@ { + "chassis": { + "name": "MSN3700", + "components": [ + { + "name": "ONIE" + }, + { + "name": "SSD" + }, + { + "name": "BIOS" + }, + { + "name": "CPLD1" + }, + { + "name": "CPLD2" + }, + { + "name": "CPLD3" + } + ], + "fans": [], + "fan_drawers": [ + { + "name": "drawer1", + "fans": [ + { + "name": "fan1" + }, + { + "name": "fan2" + } + ] + }, + { + "name": "drawer2", + "fans": [ + { + "name": "fan3" + }, + { + "name": "fan4" + } + ] + }, + { + "name": "drawer3", + "fans": [ + { + "name": "fan5" + }, + { + "name": "fan6" + } + ] + }, + { + "name": "drawer4", + "fans": [ + { + "name": "fan7" + }, + { + "name": "fan8" + } + ] + }, + { + "name": "drawer5", + "fans": [ + { + "name": "fan9" + }, + { + "name": "fan10" + } + ] + }, + { + "name": "drawer6", + "fans": [ + { + "name": "fan11" + }, + { + "name": "fan12" + } + ] + } + ], + "psus": [ + { + "name": "PSU 1", + "fans": [ + { + "name": "psu_1_fan_1" + } + ], + "thermals": [ + { + "name": "PSU-1 Temp" + } + ] + }, + { + "name": "PSU 2", + "fans": [ + { + "name": "psu_2_fan_1" + } + ], + "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" + } + ] + } + ] + }, "interfaces": { "Ethernet0": { "index": "1,1,1,1", diff --git a/device/mellanox/x86_64-mlnx_msn3700c-r0/platform.json b/device/mellanox/x86_64-mlnx_msn3700c-r0/platform.json index 0a39adfa26a4..9b62165447e0 100644 --- a/device/mellanox/x86_64-mlnx_msn3700c-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn3700c-r0/platform.json @@ -1,4 +1,383 @@ { + "chassis": { + "name": "MSN3700C", + "components": [ + { + "name": "ONIE" + }, + { + "name": "SSD" + }, + { + "name": "BIOS" + }, + { + "name": "CPLD1" + }, + { + "name": "CPLD2" + }, + { + "name": "CPLD3" + } + ], + "fans": [], + "fan_drawers": [ + { + "name": "drawer1", + "fans": [ + { + "name": "fan1" + }, + { + "name": "fan2" + } + ] + }, + { + "name": "drawer2", + "fans": [ + { + "name": "fan3" + }, + { + "name": "fan4" + } + ] + }, + { + "name": "drawer3", + "fans": [ + { + "name": "fan5" + }, + { + "name": "fan6" + } + ] + }, + { + "name": "drawer4", + "fans": [ + { + "name": "fan7" + }, + { + "name": "fan8" + } + ] + } + ], + "psus": [ + { + "name": "PSU 1", + "fans": [ + { + "name": "psu_1_fan_1" + } + ], + "thermals": [ + { + "name": "PSU-1 Temp" + } + ] + }, + { + "name": "PSU 2", + "fans": [ + { + "name": "psu_2_fan_1" + } + ], + "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 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" + } + ] + } + ] + }, "interfaces": { "Ethernet0": { "index": "1,1,1,1", diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/platform.json b/device/mellanox/x86_64-mlnx_msn3800-r0/platform.json index 6564e7dfdaa1..ed6122236663 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/platform.json @@ -1,4 +1,724 @@ { + "chassis": { + "name": "MSN3800", + "components": [ + { + "name": "ONIE" + }, + { + "name": "SSD" + }, + { + "name": "BIOS" + }, + { + "name": "CPLD1" + }, + { + "name": "CPLD2" + }, + { + "name": "CPLD3" + }, + { + "name": "CPLD4" + } + ], + "fans": [], + "fan_drawers": [ + { + "name": "drawer1", + "fans": [ + { + "name": "fan1" + } + ] + }, + { + "name": "drawer2", + "fans": [ + { + "name": "fan2" + } + ] + }, + { + "name": "drawer3", + "fans": [ + { + "name": "fan3" + } + ] + } + ], + "psus": [ + { + "name": "PSU 1", + "fans": [ + { + "name": "psu_1_fan_1" + } + ], + "thermals": [ + { + "name": "PSU-1 Temp" + } + ] + }, + { + "name": "PSU 2", + "fans": [ + { + "name": "psu_2_fan_1" + } + ], + "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" + }, + { + "name": "Gearbox 1 Temp" + }, + { + "name": "Gearbox 2 Temp" + }, + { + "name": "Gearbox 3 Temp" + }, + { + "name": "Gearbox 4 Temp" + }, + { + "name": "Gearbox 5 Temp" + }, + { + "name": "Gearbox 6 Temp" + }, + { + "name": "Gearbox 7 Temp" + }, + { + "name": "Gearbox 8 Temp" + }, + { + "name": "Gearbox 9 Temp" + }, + { + "name": "Gearbox 10 Temp" + }, + { + "name": "Gearbox 11 Temp" + }, + { + "name": "Gearbox 12 Temp" + }, + { + "name": "Gearbox 13 Temp" + }, + { + "name": "Gearbox 14 Temp" + }, + { + "name": "Gearbox 15 Temp" + }, + { + "name": "Gearbox 16 Temp" + }, + { + "name": "Gearbox 17 Temp" + }, + { + "name": "Gearbox 18 Temp" + }, + { + "name": "Gearbox 19 Temp" + }, + { + "name": "Gearbox 20 Temp" + }, + { + "name": "Gearbox 21 Temp" + }, + { + "name": "Gearbox 22 Temp" + }, + { + "name": "Gearbox 23 Temp" + }, + { + "name": "Gearbox 24 Temp" + }, + { + "name": "Gearbox 25 Temp" + }, + { + "name": "Gearbox 26 Temp" + }, + { + "name": "Gearbox 27 Temp" + }, + { + "name": "Gearbox 28 Temp" + }, + { + "name": "Gearbox 29 Temp" + }, + { + "name": "Gearbox 30 Temp" + }, + { + "name": "Gearbox 31 Temp" + }, + { + "name": "Gearbox 32 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", diff --git a/device/mellanox/x86_64-mlnx_msn4410-r0/platform.json b/device/mellanox/x86_64-mlnx_msn4410-r0/platform.json index e1ea36676bd2..d50fc6f5c6de 100644 --- a/device/mellanox/x86_64-mlnx_msn4410-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn4410-r0/platform.json @@ -1,4 +1,411 @@ { + "chassis": { + "name": "MSN4410", + "components": [ + { + "name": "ONIE" + }, + { + "name": "SSD" + }, + { + "name": "BIOS" + }, + { + "name": "CPLD1" + }, + { + "name": "CPLD2" + }, + { + "name": "CPLD3" + } + ], + "fans": [], + "fan_drawers": [ + { + "name": "drawer1", + "fans": [ + { + "name": "fan1" + }, + { + "name": "fan2" + } + ] + }, + { + "name": "drawer2", + "fans": [ + { + "name": "fan3" + }, + { + "name": "fan4" + } + ] + }, + { + "name": "drawer3", + "fans": [ + { + "name": "fan5" + }, + { + "name": "fan6" + } + ] + }, + { + "name": "drawer4", + "fans": [ + { + "name": "fan7" + }, + { + "name": "fan8" + } + ] + }, + { + "name": "drawer5", + "fans": [ + { + "name": "fan9" + }, + { + "name": "fan10" + } + ] + }, + { + "name": "drawer6", + "fans": [ + { + "name": "fan11" + }, + { + "name": "fan12" + } + ] + } + ], + "psus": [ + { + "name": "PSU 1", + "fans": [ + { + "name": "psu_1_fan_1" + } + ], + "thermals": [ + { + "name": "PSU-1 Temp" + } + ] + }, + { + "name": "PSU 2", + "fans": [ + { + "name": "psu_2_fan_1" + } + ], + "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" + } + ] + } + ] + }, "interfaces": { "Ethernet0": { "index": "1,1,1,1", diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/platform.json b/device/mellanox/x86_64-mlnx_msn4600-r0/platform.json index e5d16cc578f5..9794c0d94a18 100644 --- a/device/mellanox/x86_64-mlnx_msn4600-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/platform.json @@ -1,4 +1,625 @@ { + "chassis": { + "name": "MSN4600", + "components": [ + { + "name": "ONIE" + }, + { + "name": "SSD" + }, + { + "name": "BIOS" + }, + { + "name": "CPLD1" + }, + { + "name": "CPLD2" + }, + { + "name": "CPLD3" + } + ], + "fans": [], + "fan_drawers": [ + { + "name": "drawer1", + "fans": [ + { + "name": "fan1" + } + ] + }, + { + "name": "drawer2", + "fans": [ + { + "name": "fan2" + } + ] + }, + { + "name": "drawer3", + "fans": [ + { + "name": "fan3" + } + ] + } + ], + "psus": [ + { + "name": "PSU 1", + "fans": [ + { + "name": "psu_1_fan_1" + } + ], + "thermals": [ + { + "name": "PSU-1 Temp" + } + ] + }, + { + "name": "PSU 2", + "fans": [ + { + "name": "psu_2_fan_1" + } + ], + "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", diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/platform.json b/device/mellanox/x86_64-mlnx_msn4600c-r0/platform.json index adf8e27478aa..37decda69d6b 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/platform.json @@ -1,4 +1,619 @@ { + "chassis": { + "name": "MSN4600C", + "components": [ + { + "name": "ONIE" + }, + { + "name": "SSD" + }, + { + "name": "BIOS" + }, + { + "name": "CPLD1" + }, + { + "name": "CPLD2" + }, + { + "name": "CPLD3" + } + ], + "fans": [], + "fan_drawers": [ + { + "name": "drawer1", + "fans": [ + { + "name": "fan1" + } + ] + }, + { + "name": "drawer2", + "fans": [ + { + "name": "fan2" + } + ] + }, + { + "name": "drawer3", + "fans": [ + { + "name": "fan3" + } + ] + } + ], + "psus": [ + { + "name": "PSU 1", + "fans": [ + { + "name": "psu_1_fan_1" + } + ], + "thermals": [ + { + "name": "PSU-1 Temp" + } + ] + }, + { + "name": "PSU 2", + "fans": [ + { + "name": "psu_2_fan_1" + } + ], + "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 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", diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/platform.json b/device/mellanox/x86_64-mlnx_msn4700-r0/platform.json index 5822631ab016..a9c1c5dd0584 100644 --- a/device/mellanox/x86_64-mlnx_msn4700-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/platform.json @@ -1,4 +1,411 @@ { + "chassis": { + "name": "MSN4700", + "components": [ + { + "name": "ONIE" + }, + { + "name": "SSD" + }, + { + "name": "BIOS" + }, + { + "name": "CPLD1" + }, + { + "name": "CPLD2" + }, + { + "name": "CPLD3" + } + ], + "fans": [], + "fan_drawers": [ + { + "name": "drawer1", + "fans": [ + { + "name": "fan1" + }, + { + "name": "fan2" + } + ] + }, + { + "name": "drawer2", + "fans": [ + { + "name": "fan3" + }, + { + "name": "fan4" + } + ] + }, + { + "name": "drawer3", + "fans": [ + { + "name": "fan5" + }, + { + "name": "fan6" + } + ] + }, + { + "name": "drawer4", + "fans": [ + { + "name": "fan7" + }, + { + "name": "fan8" + } + ] + }, + { + "name": "drawer5", + "fans": [ + { + "name": "fan9" + }, + { + "name": "fan10" + } + ] + }, + { + "name": "drawer6", + "fans": [ + { + "name": "fan11" + }, + { + "name": "fan12" + } + ] + } + ], + "psus": [ + { + "name": "PSU 1", + "fans": [ + { + "name": "psu_1_fan_1" + } + ], + "thermals": [ + { + "name": "PSU-1 Temp" + } + ] + }, + { + "name": "PSU 2", + "fans": [ + { + "name": "psu_2_fan_1" + } + ], + "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" + } + ] + } + ] + }, "interfaces": { "Ethernet0": { "index": "1,1,1,1,1,1,1,1", From aeb73ad5295039ee1fb7fdf841e5a970c554b012 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Mon, 3 May 2021 12:29:57 -0700 Subject: [PATCH 014/136] [ci]: increase official build to 12 hours 10-hour limit is not enough to finish several jobs. Signed-off-by: Guohan Lu --- .azure-pipelines/azure-pipelines-job-groups.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/azure-pipelines-job-groups.yml b/.azure-pipelines/azure-pipelines-job-groups.yml index d5be80dcde3f..1a4dbb79cc0e 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: 600 + default: 720 - name: 'jobFilters' type: object default: '' From 853c21495111dfc09898097e3bbe79d7fdaff801 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Mon, 3 May 2021 12:31:52 -0700 Subject: [PATCH 015/136] [ci]: set -ex for official build to exit on any build failures Signed-off-by: Guohan Lu --- .azure-pipelines/azure-pipelines-build.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.azure-pipelines/azure-pipelines-build.yml b/.azure-pipelines/azure-pipelines-build.yml index a285aae0235b..3e718fad5081 100644 --- a/.azure-pipelines/azure-pipelines-build.yml +++ b/.azure-pipelines/azure-pipelines-build.yml @@ -41,9 +41,11 @@ jobs: - name: vs variables: dbg_image: yes + - name: barefoot variables: swi_image: yes + - name: broadcom variables: dbg_image: yes @@ -51,39 +53,48 @@ jobs: raw_image: yes sync_rpc_image: yes platform_rpc: brcm + - name: centec variables: dbg_image: yes sync_rpc_image: yes platform_rpc: centec + - name: centec-arm64 pool: sonicbld_8c timeoutInMinutes: 2160 variables: PLATFORM_ARCH: arm64 + - name: generic variables: dbg_image: yes + - name: innovium variables: swi_image: yes + - name: marvell-armhf pool: sonicbld_8c timeoutInMinutes: 2160 variables: PLATFORM_ARCH: armhf + - name: mellanox variables: dbg_image: yes sync_rpc_image: yes platform_rpc: mlnx + - name: nephos variables: dbg_image: yes sync_rpc_image: yes platform_rpc: nephos + buildSteps: - bash: | + 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 From b2286a24dc969e031f3226d57b95ec809d35c99e Mon Sep 17 00:00:00 2001 From: Stephen Sun <5379172+stephenxs@users.noreply.github.com> Date: Tue, 4 May 2021 08:10:18 +0800 Subject: [PATCH 016/136] [Mellanox] Adopt single way to get fan direction for all ASIC types (#7386) #### Why I did it Adopt a single way to get fan direction for all ASIC types. It depends on hw-mgmt V.7.0010.2000.2303. Depends on https://github.com/Azure/sonic-buildimage/pull/7419 #### How I did it Originally, the get_direction was implemented by fetching and parsing `/var/run/hw-management/system/fan_dir` on the Spectrum-2 and the Spectrum-3 systems. It isn't supported on the Spectrum system. Now, it is implemented by fetching `/var/run/hw-management/thermal/fanX_dir` for all the platforms. Signed-off-by: Stephen Sun --- .../sonic_platform/device_data.py | 10 +++++----- .../mlnx-platform-api/sonic_platform/fan.py | 6 ++++-- .../sonic_platform/fan_drawer.py | 17 +++++++++-------- 3 files changed, 18 insertions(+), 15 deletions(-) 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 a52886a9de51..e1124d0d55e3 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/device_data.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/device_data.py @@ -10,7 +10,7 @@ 'drawer_num': 4, 'drawer_type': 'real', 'fan_num_per_drawer': 2, - 'support_fan_direction': False, + 'support_fan_direction': True, 'hot_swappable': True }, 'psus': { @@ -31,7 +31,7 @@ 'drawer_num': 4, 'drawer_type': 'real', 'fan_num_per_drawer': 1, - 'support_fan_direction': False, + 'support_fan_direction': True, 'hot_swappable': True }, 'psus': { @@ -52,7 +52,7 @@ 'drawer_num': 1, 'drawer_type': 'virtual', 'fan_num_per_drawer': 4, - 'support_fan_direction': False, + 'support_fan_direction': True, 'hot_swappable': False }, 'psus': { @@ -73,7 +73,7 @@ 'drawer_num': 4, 'drawer_type': 'real', 'fan_num_per_drawer': 2, - 'support_fan_direction': False, + 'support_fan_direction': True, 'hot_swappable': True }, 'psus': { @@ -94,7 +94,7 @@ 'drawer_num': 1, 'drawer_type': 'virtual', 'fan_num_per_drawer': 4, - 'support_fan_direction': False, + 'support_fan_direction': True, 'hot_swappable': False }, 'psus': { diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/fan.py b/platform/mellanox/mlnx-platform-api/sonic_platform/fan.py index 98e5c40fc3df..3ae5c4847c92 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/fan.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/fan.py @@ -22,8 +22,10 @@ FAN_PATH = "/var/run/hw-management/thermal/" CONFIG_PATH = "/var/run/hw-management/config" -# fan_dir isn't supported on Spectrum 1. It is supported on Spectrum 2 and later switches -FAN_DIR = "/var/run/hw-management/system/fan_dir" + +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): 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 66ee39491735..fcf9b802636e 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/fan_drawer.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/fan_drawer.py @@ -14,6 +14,7 @@ from sonic_platform_base.fan_drawer_base import FanDrawerBase from sonic_platform_base.fan_base import FanBase from .led import FanLed, SharedLed + from .utils import read_int_from_file except ImportError as e: raise ImportError (str(e) + "- required module not found") @@ -51,14 +52,14 @@ def get_direction(self): return FanBase.FAN_DIRECTION_NOT_APPLICABLE try: - from .fan import FAN_DIR - with open(FAN_DIR, 'r') as fan_dir: - fan_dir_bits = int(fan_dir.read()) - fan_mask = 1 << self._index - 1 - if fan_dir_bits & fan_mask: - return FanBase.FAN_DIRECTION_INTAKE - else: - return FanBase.FAN_DIRECTION_EXHAUST + 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) + 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)) except (ValueError, IOError) as e: raise RuntimeError("Failed to read fan direction status to {}".format(repr(e))) From e52fdcfd7260714c5a023fbc56f1506855563966 Mon Sep 17 00:00:00 2001 From: Andriy Yurkiv <70649192+ayurkiv-nvda@users.noreply.github.com> Date: Tue, 4 May 2021 17:34:33 +0300 Subject: [PATCH 017/136] [Mellanox] Add support to VXLAN src port range setting via SAI profile for r SN3800-D28C49S1 (#7500) - Why I did it Enable VXLAN src port range configuration via SAI profile for Mellanox-SN3800-D28C49S1 SKU - How I did it Added SAI_VXLAN_SRCPORT_RANGE_ENABLE=1 configuration to appropriate sai.profile Signed-off-by: Andriy Yurkiv --- .../x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C49S1/sai.profile | 1 + 1 file changed, 1 insertion(+) 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 4ecb05a1a9e5..24a5baa1174d 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 +1,2 @@ SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_3800_1x10g_28x50g_49x100g.xml +SAI_VXLAN_SRCPORT_RANGE_ENABLE=1 From 0bc0f98d48e82c0dad490a9aa09063fcebd09022 Mon Sep 17 00:00:00 2001 From: Alexander Allen Date: Tue, 4 May 2021 16:07:00 -0400 Subject: [PATCH 018/136] [platform] Add serial number and model number to Mellanox PSU platform implementation (#7382) #### Why I did it We want to add the ability for the command `show platform psustatus` to show the serial number and part number of the PSU devices on Mellanox platforms. This will be useful for data-center management of field replaceable units (FRUs) on switches. #### How I did it I implemented the platform 2.0 functions `get_model()` and `get_serial()` for the PSU in the mellanox platform API by referencing the sysfs nodes provided by the [hw-management](https://github.com/Azure/sonic-buildimage/tree/master/platform/mellanox/hw-management) module. --- .../mlnx-platform-api/sonic_platform/psu.py | 79 ++++++++++++++++++- 1 file changed, 76 insertions(+), 3 deletions(-) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py b/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py index cb05278d5b66..12b7a35b7a7b 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py @@ -27,26 +27,40 @@ PSU_CURRENT = "current" PSU_VOLTAGE = "voltage" PSU_POWER = "power" +PSU_VPD = "vpd" + +SN_VPD_FIELD = "SN_VPD_FIELD" +PN_VPD_FIELD = "PN_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_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_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_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 } ] @@ -73,6 +87,27 @@ def __init__(self, psu_index, platform): filemap = psu_profile_list[0] self.psu_data = DEVICE_DATA[platform]['psus'] + psu_vpd = filemap[PSU_VPD] + + 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: + self.model = "" + 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: + self.serial = "" + logger.log_error("Fail to read PSU{} serial number: No key {} in VPD {}".format(self.index, SN_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 @@ -122,6 +157,24 @@ 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 @@ -137,6 +190,26 @@ def _read_generic_file(self, filename, len): 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 + + + def get_serial(self): + """ + Retrieves the serial number of the device + + Returns: + string: Serial number of device + """ + return self.serial + + def get_powergood_status(self): """ Retrieves the operational status of power supply unit (PSU) defined From 2d3149d641adf757a02206d642821faf245cac2e Mon Sep 17 00:00:00 2001 From: shlomibitton <60430976+shlomibitton@users.noreply.github.com> Date: Wed, 5 May 2021 09:47:57 +0300 Subject: [PATCH 019/136] [Mellanox] Update FW to xx.2008.2526 (#7511) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Why I did it Updated FW to xx.2008.2526 version. Fixed issues: 1. Spectrum-2, Spectrum-3 | sFlow | High CPU load and high on fully loaded switch. 2. Spectrum-2, Spectrum-3 | Fine grain LAG | in rare cases doesn’t update the right entry - How I did it Updated submodule pointer and version in a Makefile. - How to verify it Full regression and bugs validation Signed-off-by: Shlomi Bitton --- platform/mellanox/fw.mk | 6 +++--- platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index 23823116af2f..0a23317e3812 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -11,17 +11,17 @@ else FW_FROM_URL = n endif -MLNX_SPC_FW_VERSION = 13.2008.2520 +MLNX_SPC_FW_VERSION = 13.2008.2526 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.2520 +MLNX_SPC2_FW_VERSION = 29.2008.2526 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.2520 +MLNX_SPC3_FW_VERSION = 30.2008.2526 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/sdk-src/sx-kernel/Switch-SDK-drivers b/platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers index 688ae3b21121..29b0dd657444 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 688ae3b21121d3ecc961f0ca93e596a1ed5edbb7 +Subproject commit 29b0dd6574448e15aa207a23bda89afc2d19a831 From e7db9fe46c69eacf9ed0e6954975269138774d99 Mon Sep 17 00:00:00 2001 From: Aravind Mani <53524901+aravindmani-1@users.noreply.github.com> Date: Wed, 5 May 2021 06:50:24 -0700 Subject: [PATCH 020/136] DellEMC: Z9332f media settings (#7485) Changed DellEMC Z9932f media settings from Vendor Name + PN method to common method. --- .../media_settings.json | 7746 +++++++---------- 1 file changed, 2912 insertions(+), 4834 deletions(-) diff --git a/device/dell/x86_64-dellemc_z9332f_d1508-r0/media_settings.json b/device/dell/x86_64-dellemc_z9332f_d1508-r0/media_settings.json index efd181116976..130427ae99cb 100644 --- a/device/dell/x86_64-dellemc_z9332f_d1508-r0/media_settings.json +++ b/device/dell/x86_64-dellemc_z9332f_d1508-r0/media_settings.json @@ -1,7 +1,7 @@ { "PORT_MEDIA_SETTINGS":{ "1":{ - "Amphenol-NDVYYF-0001":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -63,7 +63,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -125,7 +125,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -187,7 +187,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -249,131 +249,7 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x0000008c", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "ONET-1AT-5QAM15XX-10A":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -435,7 +311,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -497,7 +373,7 @@ "lane7": "0xfffffff0" } }, - "QSFP28-40GBASE-CR4-1M":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -529,7 +405,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-2M":{ + "QSFP28-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -561,7 +437,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -593,7 +469,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -655,7 +531,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x00000046", + "lane1": "0x00000048", + "lane2": "0x00000044", + "lane3": "0x00000044", + "lane4": "0x00000046", + "lane5": "0x00000048", + "lane6": "0x00000044", + "lane7": "0x00000044" + }, + "post1":{ + "lane0": "0xffffffec", + "lane1": "0xffffffec", + "lane2": "0xfffffff0", + "lane3": "0xfffffff0", + "lane4": "0xffffffec", + "lane5": "0xffffffec", + "lane6": "0xfffffff0", + "lane7": "0xfffffff0" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -687,7 +595,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -719,7 +627,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -751,7 +659,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -783,7 +691,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -814,10 +722,42 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } + }, + "QSFP+-*":{ + "main":{ + "lane0": "0x0000004a", + "lane1": "0x0000004a", + "lane2": "0x0000004a", + "lane3": "0x0000004a", + "lane4": "0x0000004a", + "lane5": "0x0000004a", + "lane6": "0x0000004a", + "lane7": "0x0000004a" + }, + "post1":{ + "lane0": "0xfffffff2", + "lane1": "0xfffffff2", + "lane2": "0xfffffff2", + "lane3": "0xfffffff2", + "lane4": "0xfffffff2", + "lane5": "0xfffffff2", + "lane6": "0xfffffff2", + "lane7": "0xfffffff2" + }, + "pre1":{ + "lane0": "0xfffffffe", + "lane1": "0xfffffffe", + "lane2": "0xfffffffe", + "lane3": "0xfffffffe", + "lane4": "0xfffffffe", + "lane5": "0xfffffffe", + "lane6": "0xfffffffe", + "lane7": "0xfffffffe" + } } }, "2":{ - "Amphenol-NDVYYF-0001":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -879,7 +819,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -941,7 +881,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -1003,7 +943,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -1065,69 +1005,7 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x0000008c", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -1189,7 +1067,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM15XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -1251,18 +1129,18 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" + "lane0": "0x00000069", + "lane1": "0x00000069", + "lane2": "0x00000069", + "lane3": "0x00000069", + "lane4": "0x00000069", + "lane5": "0x00000069", + "lane6": "0x00000069", + "lane7": "0x00000069" }, - "post2":{ + "post1":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -1272,91 +1150,29 @@ "lane6": "0x00000000", "lane7": "0x00000000" }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "QSFP28-40GBASE-CR4-1M":{ - "main":{ - "lane0": "0x00000069", - "lane1": "0x00000069", - "lane2": "0x00000069", - "lane3": "0x00000069", - "lane4": "0x00000069", - "lane5": "0x00000069", - "lane6": "0x00000069", - "lane7": "0x00000069" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffec", - "lane1": "0xffffffec", - "lane2": "0xffffffec", - "lane3": "0xffffffec", - "lane4": "0xffffffec", - "lane5": "0xffffffec", - "lane6": "0xffffffec", - "lane7": "0xffffffec" - } - }, - "QSFP28-40GBASE-CR4-2M":{ - "main":{ - "lane0": "0x00000069", - "lane1": "0x00000069", - "lane2": "0x00000069", - "lane3": "0x00000069", - "lane4": "0x00000069", - "lane5": "0x00000069", - "lane6": "0x00000069", - "lane7": "0x00000069" - }, - "post1":{ + "pre1":{ + "lane0": "0xffffffec", + "lane1": "0xffffffec", + "lane2": "0xffffffec", + "lane3": "0xffffffec", + "lane4": "0xffffffec", + "lane5": "0xffffffec", + "lane6": "0xffffffec", + "lane7": "0xffffffec" + } + }, + "QSFP28-40GBASE-CR4-2.0M":{ + "main":{ + "lane0": "0x00000069", + "lane1": "0x00000069", + "lane2": "0x00000069", + "lane3": "0x00000069", + "lane4": "0x00000069", + "lane5": "0x00000069", + "lane6": "0x00000069", + "lane7": "0x00000069" + }, + "post1":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -1377,7 +1193,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -1409,7 +1225,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -1471,7 +1287,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x0000003c", + "lane1": "0x00000044", + "lane2": "0x00000046", + "lane3": "0x00000044", + "lane4": "0x0000003c", + "lane5": "0x00000044", + "lane6": "0x00000046", + "lane7": "0x00000044" + }, + "post1":{ + "lane0": "0xfffffff0", + "lane1": "0xfffffff4", + "lane2": "0xfffffff4", + "lane3": "0xfffffff0", + "lane4": "0xfffffff0", + "lane5": "0xfffffff4", + "lane6": "0xfffffff4", + "lane7": "0xfffffff0" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -1503,7 +1351,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -1535,7 +1383,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -1567,7 +1415,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -1599,7 +1447,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -1630,10 +1478,42 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } + }, + "QSFP+-*":{ + "main":{ + "lane0": "0x0000004a", + "lane1": "0x0000004a", + "lane2": "0x0000004a", + "lane3": "0x0000004a", + "lane4": "0x0000004a", + "lane5": "0x0000004a", + "lane6": "0x0000004a", + "lane7": "0x0000004a" + }, + "post1":{ + "lane0": "0xfffffff2", + "lane1": "0xfffffff2", + "lane2": "0xfffffff2", + "lane3": "0xfffffff2", + "lane4": "0xfffffff2", + "lane5": "0xfffffff2", + "lane6": "0xfffffff2", + "lane7": "0xfffffff2" + }, + "pre1":{ + "lane0": "0xfffffffe", + "lane1": "0xfffffffe", + "lane2": "0xfffffffe", + "lane3": "0xfffffffe", + "lane4": "0xfffffffe", + "lane5": "0xfffffffe", + "lane6": "0xfffffffe", + "lane7": "0xfffffffe" + } } }, "3":{ - "Amphenol-NDVYYF-0001":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -1695,7 +1575,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -1757,7 +1637,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -1819,7 +1699,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -1881,131 +1761,7 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x0000008c", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "ONET-1AT-5QAM15XX-10A":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -2067,7 +1823,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -2129,7 +1885,7 @@ "lane7": "0xfffffff0" } }, - "QSFP28-40GBASE-CR4-1M":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -2161,7 +1917,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-2M":{ + "QSFP28-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -2193,7 +1949,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -2225,7 +1981,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -2287,7 +2043,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x0000003c", + "lane1": "0x00000048", + "lane2": "0x00000044", + "lane3": "0x00000044", + "lane4": "0x0000003c", + "lane5": "0x00000048", + "lane6": "0x00000044", + "lane7": "0x00000044" + }, + "post1":{ + "lane0": "0xfffffff0", + "lane1": "0xfffffff4", + "lane2": "0xfffffff6", + "lane3": "0xfffffff4", + "lane4": "0xfffffff0", + "lane5": "0xfffffff4", + "lane6": "0xfffffff6", + "lane7": "0xfffffff4" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -2319,7 +2107,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -2351,7 +2139,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -2383,7 +2171,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -2415,7 +2203,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -2446,18 +2234,50 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } - } - }, - "4":{ - "Amphenol-NDVYYF-0001":{ + }, + "QSFP+-*":{ "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x0000008c", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", + "lane0": "0x00000046", + "lane1": "0x00000046", + "lane2": "0x00000046", + "lane3": "0x00000046", + "lane4": "0x00000046", + "lane5": "0x00000046", + "lane6": "0x00000046", + "lane7": "0x00000046" + }, + "post1":{ + "lane0": "0xfffffff4", + "lane1": "0xfffffff4", + "lane2": "0xfffffff4", + "lane3": "0xfffffff4", + "lane4": "0xfffffff4", + "lane5": "0xfffffff4", + "lane6": "0xfffffff4", + "lane7": "0xfffffff4" + }, + "pre1":{ + "lane0": "0xfffffffe", + "lane1": "0xfffffffe", + "lane2": "0xfffffffe", + "lane3": "0xfffffffe", + "lane4": "0xfffffffe", + "lane5": "0xfffffffe", + "lane6": "0xfffffffe", + "lane7": "0xfffffffe" + } + } + }, + "4":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ + "main":{ + "lane0": "0x00000088", + "lane1": "0x00000088", + "lane2": "0x0000008c", + "lane3": "0x00000088", + "lane4": "0x00000088", + "lane5": "0x00000088", + "lane6": "0x00000088", "lane7": "0x00000088" }, "post1":{ @@ -2511,7 +2331,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -2573,7 +2393,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -2635,7 +2455,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -2697,131 +2517,7 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x0000008c", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "ONET-1AT-5QAM15XX-10A":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -2883,7 +2579,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -2945,7 +2641,7 @@ "lane7": "0xfffffff0" } }, - "QSFP28-40GBASE-CR4-1M":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -2977,7 +2673,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-2M":{ + "QSFP28-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -3009,7 +2705,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -3041,7 +2737,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -3103,7 +2799,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x00000036", + "lane1": "0x00000044", + "lane2": "0x00000044", + "lane3": "0x00000040", + "lane4": "0x00000036", + "lane5": "0x00000044", + "lane6": "0x00000044", + "lane7": "0x00000040" + }, + "post1":{ + "lane0": "0xfffffff4", + "lane1": "0xfffffff8", + "lane2": "0xfffffff8", + "lane3": "0xfffffff4", + "lane4": "0xfffffff4", + "lane5": "0xfffffff8", + "lane6": "0xfffffff8", + "lane7": "0xfffffff4" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -3135,7 +2863,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -3167,7 +2895,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -3199,7 +2927,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -3231,7 +2959,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -3262,10 +2990,42 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } + }, + "QSFP+-*":{ + "main":{ + "lane0": "0x00000046", + "lane1": "0x00000046", + "lane2": "0x00000046", + "lane3": "0x00000046", + "lane4": "0x00000046", + "lane5": "0x00000046", + "lane6": "0x00000046", + "lane7": "0x00000046" + }, + "post1":{ + "lane0": "0xfffffff4", + "lane1": "0xfffffff4", + "lane2": "0xfffffff4", + "lane3": "0xfffffff4", + "lane4": "0xfffffff4", + "lane5": "0xfffffff4", + "lane6": "0xfffffff4", + "lane7": "0xfffffff4" + }, + "pre1":{ + "lane0": "0xfffffffe", + "lane1": "0xfffffffe", + "lane2": "0xfffffffe", + "lane3": "0xfffffffe", + "lane4": "0xfffffffe", + "lane5": "0xfffffffe", + "lane6": "0xfffffffe", + "lane7": "0xfffffffe" + } } }, "5":{ - "Amphenol-NDVYYF-0001":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -3327,7 +3087,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -3389,7 +3149,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -3451,7 +3211,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -3513,69 +3273,7 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x0000008c", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -3637,7 +3335,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM15XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -3699,80 +3397,18 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" + "lane0": "0x00000069", + "lane1": "0x00000069", + "lane2": "0x00000069", + "lane3": "0x00000069", + "lane4": "0x00000069", + "lane5": "0x00000069", + "lane6": "0x00000069", + "lane7": "0x00000069" }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "QSFP28-40GBASE-CR4-1M":{ - "main":{ - "lane0": "0x00000069", - "lane1": "0x00000069", - "lane2": "0x00000069", - "lane3": "0x00000069", - "lane4": "0x00000069", - "lane5": "0x00000069", - "lane6": "0x00000069", - "lane7": "0x00000069" - }, - "post1":{ + "post1":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -3793,7 +3429,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-2M":{ + "QSFP28-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -3825,7 +3461,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -3857,7 +3493,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -3919,7 +3555,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x0000003c", + "lane1": "0x00000040", + "lane2": "0x0000003c", + "lane3": "0x00000040", + "lane4": "0x0000003c", + "lane5": "0x00000040", + "lane6": "0x0000003c", + "lane7": "0x00000040" + }, + "post1":{ + "lane0": "0xfffffff6", + "lane1": "0xfffffff0", + "lane2": "0xfffffff6", + "lane3": "0xfffffff8", + "lane4": "0xfffffff6", + "lane5": "0xfffffff0", + "lane6": "0xfffffff6", + "lane7": "0xfffffff8" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -3951,7 +3619,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -3983,7 +3651,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -4015,7 +3683,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -4047,7 +3715,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -4078,10 +3746,42 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } + }, + "QSFP+-*":{ + "main":{ + "lane0": "0x00000046", + "lane1": "0x00000046", + "lane2": "0x00000046", + "lane3": "0x00000046", + "lane4": "0x00000046", + "lane5": "0x00000046", + "lane6": "0x00000046", + "lane7": "0x00000046" + }, + "post1":{ + "lane0": "0xfffffff4", + "lane1": "0xfffffff4", + "lane2": "0xfffffff4", + "lane3": "0xfffffff4", + "lane4": "0xfffffff4", + "lane5": "0xfffffff4", + "lane6": "0xfffffff4", + "lane7": "0xfffffff4" + }, + "pre1":{ + "lane0": "0xfffffffe", + "lane1": "0xfffffffe", + "lane2": "0xfffffffe", + "lane3": "0xfffffffe", + "lane4": "0xfffffffe", + "lane5": "0xfffffffe", + "lane6": "0xfffffffe", + "lane7": "0xfffffffe" + } } }, "6":{ - "Amphenol-NDVYYF-0001":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -4143,7 +3843,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -4205,7 +3905,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -4267,7 +3967,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -4329,131 +4029,7 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x0000008c", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "ONET-1AT-5QAM15XX-10A":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -4515,7 +4091,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -4577,7 +4153,7 @@ "lane7": "0xfffffff0" } }, - "QSFP28-40GBASE-CR4-1M":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -4609,7 +4185,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-2M":{ + "QSFP28-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -4641,7 +4217,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -4673,7 +4249,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -4735,7 +4311,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x00000036", + "lane1": "0x00000044", + "lane2": "0x0000003c", + "lane3": "0x00000040", + "lane4": "0x00000036", + "lane5": "0x00000044", + "lane6": "0x0000003c", + "lane7": "0x00000040" + }, + "post1":{ + "lane0": "0xfffffff6", + "lane1": "0xfffffff0", + "lane2": "0xfffffff6", + "lane3": "0xfffffff8", + "lane4": "0xfffffff6", + "lane5": "0xfffffff0", + "lane6": "0xfffffff6", + "lane7": "0xfffffff8" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -4767,7 +4375,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -4799,7 +4407,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -4831,7 +4439,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -4863,7 +4471,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -4894,10 +4502,42 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } + }, + "QSFP+-*":{ + "main":{ + "lane0": "0x00000046", + "lane1": "0x00000046", + "lane2": "0x00000046", + "lane3": "0x00000046", + "lane4": "0x00000046", + "lane5": "0x00000046", + "lane6": "0x00000046", + "lane7": "0x00000046" + }, + "post1":{ + "lane0": "0xfffffff4", + "lane1": "0xfffffff4", + "lane2": "0xfffffff4", + "lane3": "0xfffffff4", + "lane4": "0xfffffff4", + "lane5": "0xfffffff4", + "lane6": "0xfffffff4", + "lane7": "0xfffffff4" + }, + "pre1":{ + "lane0": "0xfffffffe", + "lane1": "0xfffffffe", + "lane2": "0xfffffffe", + "lane3": "0xfffffffe", + "lane4": "0xfffffffe", + "lane5": "0xfffffffe", + "lane6": "0xfffffffe", + "lane7": "0xfffffffe" + } } }, "7":{ - "Amphenol-NDVYYF-0001":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -4959,7 +4599,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -5021,7 +4661,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -5083,7 +4723,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -5145,18 +4785,18 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", - "lane2": "0x0000008c", + "lane2": "0x00000088", "lane3": "0x00000088", "lane4": "0x00000088", "lane5": "0x00000088", "lane6": "0x00000088", "lane7": "0x00000088" }, - "post1":{ + "post2":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -5166,7 +4806,7 @@ "lane6": "0x00000000", "lane7": "0x00000000" }, - "post2":{ + "post3":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -5176,7 +4816,7 @@ "lane6": "0x00000000", "lane7": "0x00000000" }, - "post3":{ + "pre2":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -5185,140 +4825,16 @@ "lane5": "0x00000000", "lane6": "0x00000000", "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "ONET-1AT-5QAM15XX-10A":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" + }, + "post1":{ + "lane0": "0xfffffff0", + "lane1": "0xfffffff0", + "lane2": "0xfffffff0", + "lane3": "0xfffffff0", + "lane4": "0xfffffff0", + "lane5": "0xfffffff0", + "lane6": "0xfffffff0", + "lane7": "0xfffffff0" }, "pre1":{ "lane0": "0xfffffff0", @@ -5331,7 +4847,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -5393,7 +4909,7 @@ "lane7": "0xfffffff0" } }, - "QSFP28-40GBASE-CR4-1M":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -5425,7 +4941,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-2M":{ + "QSFP28-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -5457,7 +4973,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -5489,7 +5005,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -5551,7 +5067,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x0000003c", + "lane1": "0x0000003c", + "lane2": "0x0000003c", + "lane3": "0x00000038", + "lane4": "0x0000003c", + "lane5": "0x0000003c", + "lane6": "0x0000003c", + "lane7": "0x00000038" + }, + "post1":{ + "lane0": "0xfffffff4", + "lane1": "0xfffffff6", + "lane2": "0xfffffff6", + "lane3": "0xfffffff6", + "lane4": "0xfffffff4", + "lane5": "0xfffffff6", + "lane6": "0xfffffff6", + "lane7": "0xfffffff6" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -5583,7 +5131,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -5615,7 +5163,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -5647,7 +5195,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -5679,7 +5227,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -5710,10 +5258,42 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } + }, + "QSFP+-*":{ + "main":{ + "lane0": "0x00000046", + "lane1": "0x00000046", + "lane2": "0x00000046", + "lane3": "0x00000046", + "lane4": "0x00000046", + "lane5": "0x00000046", + "lane6": "0x00000046", + "lane7": "0x00000046" + }, + "post1":{ + "lane0": "0xfffffff4", + "lane1": "0xfffffff4", + "lane2": "0xfffffff4", + "lane3": "0xfffffff4", + "lane4": "0xfffffff4", + "lane5": "0xfffffff4", + "lane6": "0xfffffff4", + "lane7": "0xfffffff4" + }, + "pre1":{ + "lane0": "0xfffffffe", + "lane1": "0xfffffffe", + "lane2": "0xfffffffe", + "lane3": "0xfffffffe", + "lane4": "0xfffffffe", + "lane5": "0xfffffffe", + "lane6": "0xfffffffe", + "lane7": "0xfffffffe" + } } }, "8":{ - "Amphenol-NDVYYF-0001":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -5775,7 +5355,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -5837,7 +5417,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -5899,7 +5479,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -5961,69 +5541,7 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x0000008c", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -6085,7 +5603,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM15XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -6147,80 +5665,18 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" + "lane0": "0x00000069", + "lane1": "0x00000069", + "lane2": "0x00000069", + "lane3": "0x00000069", + "lane4": "0x00000069", + "lane5": "0x00000069", + "lane6": "0x00000069", + "lane7": "0x00000069" }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "QSFP28-40GBASE-CR4-1M":{ - "main":{ - "lane0": "0x00000069", - "lane1": "0x00000069", - "lane2": "0x00000069", - "lane3": "0x00000069", - "lane4": "0x00000069", - "lane5": "0x00000069", - "lane6": "0x00000069", - "lane7": "0x00000069" - }, - "post1":{ + "post1":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -6241,7 +5697,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-2M":{ + "QSFP28-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -6273,7 +5729,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -6305,7 +5761,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -6367,7 +5823,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x00000036", + "lane1": "0x00000042", + "lane2": "0x0000003c", + "lane3": "0x0000003c", + "lane4": "0x00000036", + "lane5": "0x00000042", + "lane6": "0x0000003c", + "lane7": "0x0000003c" + }, + "post1":{ + "lane0": "0xfffffff4", + "lane1": "0xfffffff4", + "lane2": "0xfffffff6", + "lane3": "0xfffffff6", + "lane4": "0xfffffff4", + "lane5": "0xfffffff4", + "lane6": "0xfffffff6", + "lane7": "0xfffffff6" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -6399,7 +5887,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -6431,7 +5919,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -6463,7 +5951,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -6495,7 +5983,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -6526,10 +6014,42 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } + }, + "QSFP+-*":{ + "main":{ + "lane0": "0x00000046", + "lane1": "0x00000046", + "lane2": "0x00000046", + "lane3": "0x00000046", + "lane4": "0x00000046", + "lane5": "0x00000046", + "lane6": "0x00000046", + "lane7": "0x00000046" + }, + "post1":{ + "lane0": "0xfffffff4", + "lane1": "0xfffffff4", + "lane2": "0xfffffff4", + "lane3": "0xfffffff4", + "lane4": "0xfffffff4", + "lane5": "0xfffffff4", + "lane6": "0xfffffff4", + "lane7": "0xfffffff4" + }, + "pre1":{ + "lane0": "0xfffffffe", + "lane1": "0xfffffffe", + "lane2": "0xfffffffe", + "lane3": "0xfffffffe", + "lane4": "0xfffffffe", + "lane5": "0xfffffffe", + "lane6": "0xfffffffe", + "lane7": "0xfffffffe" + } } }, "9":{ - "Amphenol-NDVYYF-0001":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -6591,7 +6111,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -6653,7 +6173,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -6715,7 +6235,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -6777,131 +6297,7 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x0000008c", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "ONET-1AT-5QAM15XX-10A":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -6963,7 +6359,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -7025,7 +6421,7 @@ "lane7": "0xfffffff0" } }, - "QSFP28-40GBASE-CR4-1M":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -7057,7 +6453,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-2M":{ + "QSFP28-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -7089,7 +6485,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -7121,7 +6517,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -7183,7 +6579,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x00000040", + "lane1": "0x00000048", + "lane2": "0x00000040", + "lane3": "0x00000044", + "lane4": "0x00000040", + "lane5": "0x00000048", + "lane6": "0x00000040", + "lane7": "0x00000044" + }, + "post1":{ + "lane0": "0xfffffff0", + "lane1": "0xfffffff4", + "lane2": "0xfffffff4", + "lane3": "0xfffffff4", + "lane4": "0xfffffff0", + "lane5": "0xfffffff4", + "lane6": "0xfffffff4", + "lane7": "0xfffffff4" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -7215,7 +6643,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -7247,7 +6675,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -7279,7 +6707,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -7311,7 +6739,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -7342,10 +6770,42 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } + }, + "QSFP+-*":{ + "main":{ + "lane0": "0x0000004a", + "lane1": "0x0000004a", + "lane2": "0x0000004a", + "lane3": "0x0000004a", + "lane4": "0x0000004a", + "lane5": "0x0000004a", + "lane6": "0x0000004a", + "lane7": "0x0000004a" + }, + "post1":{ + "lane0": "0xfffffff2", + "lane1": "0xfffffff2", + "lane2": "0xfffffff2", + "lane3": "0xfffffff2", + "lane4": "0xfffffff2", + "lane5": "0xfffffff2", + "lane6": "0xfffffff2", + "lane7": "0xfffffff2" + }, + "pre1":{ + "lane0": "0xfffffffe", + "lane1": "0xfffffffe", + "lane2": "0xfffffffe", + "lane3": "0xfffffffe", + "lane4": "0xfffffffe", + "lane5": "0xfffffffe", + "lane6": "0xfffffffe", + "lane7": "0xfffffffe" + } } }, - "10":{ - "Amphenol-NDVYYF-0001":{ + "10":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -7407,7 +6867,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -7469,7 +6929,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -7531,7 +6991,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -7593,18 +7053,18 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", - "lane2": "0x0000008c", + "lane2": "0x00000088", "lane3": "0x00000088", "lane4": "0x00000088", "lane5": "0x00000088", "lane6": "0x00000088", "lane7": "0x00000088" }, - "post1":{ + "post2":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -7614,7 +7074,7 @@ "lane6": "0x00000000", "lane7": "0x00000000" }, - "post2":{ + "post3":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -7624,7 +7084,7 @@ "lane6": "0x00000000", "lane7": "0x00000000" }, - "post3":{ + "pre2":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -7634,139 +7094,15 @@ "lane6": "0x00000000", "lane7": "0x00000000" }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "ONET-1AT-5QAM15XX-10A":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" + "post1":{ + "lane0": "0xfffffff0", + "lane1": "0xfffffff0", + "lane2": "0xfffffff0", + "lane3": "0xfffffff0", + "lane4": "0xfffffff0", + "lane5": "0xfffffff0", + "lane6": "0xfffffff0", + "lane7": "0xfffffff0" }, "pre1":{ "lane0": "0xfffffff0", @@ -7779,7 +7115,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -7841,7 +7177,7 @@ "lane7": "0xfffffff0" } }, - "QSFP28-40GBASE-CR4-1M":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -7873,7 +7209,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-2M":{ + "QSFP28-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -7905,7 +7241,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -7937,7 +7273,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -7999,7 +7335,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x00000040", + "lane1": "0x00000044", + "lane2": "0x00000044", + "lane3": "0x00000046", + "lane4": "0x00000040", + "lane5": "0x00000044", + "lane6": "0x00000044", + "lane7": "0x00000046" + }, + "post1":{ + "lane0": "0xfffffff0", + "lane1": "0xfffffff4", + "lane2": "0xfffffff4", + "lane3": "0xfffffff0", + "lane4": "0xfffffff0", + "lane5": "0xfffffff4", + "lane6": "0xfffffff4", + "lane7": "0xfffffff0" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -8031,7 +7399,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -8063,7 +7431,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -8095,7 +7463,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -8127,7 +7495,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -8158,10 +7526,42 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } + }, + "QSFP+-*":{ + "main":{ + "lane0": "0x0000004a", + "lane1": "0x0000004a", + "lane2": "0x0000004a", + "lane3": "0x0000004a", + "lane4": "0x0000004a", + "lane5": "0x0000004a", + "lane6": "0x0000004a", + "lane7": "0x0000004a" + }, + "post1":{ + "lane0": "0xfffffff2", + "lane1": "0xfffffff2", + "lane2": "0xfffffff2", + "lane3": "0xfffffff2", + "lane4": "0xfffffff2", + "lane5": "0xfffffff2", + "lane6": "0xfffffff2", + "lane7": "0xfffffff2" + }, + "pre1":{ + "lane0": "0xfffffffe", + "lane1": "0xfffffffe", + "lane2": "0xfffffffe", + "lane3": "0xfffffffe", + "lane4": "0xfffffffe", + "lane5": "0xfffffffe", + "lane6": "0xfffffffe", + "lane7": "0xfffffffe" + } } }, - "11":{ - "Amphenol-NDVYYF-0001":{ + "11":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -8223,7 +7623,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -8285,7 +7685,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -8347,7 +7747,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -8409,69 +7809,7 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x0000008c", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -8533,7 +7871,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM15XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -8595,18 +7933,18 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" + "lane0": "0x00000069", + "lane1": "0x00000069", + "lane2": "0x00000069", + "lane3": "0x00000069", + "lane4": "0x00000069", + "lane5": "0x00000069", + "lane6": "0x00000069", + "lane7": "0x00000069" }, - "post2":{ + "post1":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -8616,91 +7954,29 @@ "lane6": "0x00000000", "lane7": "0x00000000" }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" + "pre1":{ + "lane0": "0xffffffec", + "lane1": "0xffffffec", + "lane2": "0xffffffec", + "lane3": "0xffffffec", + "lane4": "0xffffffec", + "lane5": "0xffffffec", + "lane6": "0xffffffec", + "lane7": "0xffffffec" + } + }, + "QSFP28-40GBASE-CR4-2.0M":{ + "main":{ + "lane0": "0x00000069", + "lane1": "0x00000069", + "lane2": "0x00000069", + "lane3": "0x00000069", + "lane4": "0x00000069", + "lane5": "0x00000069", + "lane6": "0x00000069", + "lane7": "0x00000069" }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "QSFP28-40GBASE-CR4-1M":{ - "main":{ - "lane0": "0x00000069", - "lane1": "0x00000069", - "lane2": "0x00000069", - "lane3": "0x00000069", - "lane4": "0x00000069", - "lane5": "0x00000069", - "lane6": "0x00000069", - "lane7": "0x00000069" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffec", - "lane1": "0xffffffec", - "lane2": "0xffffffec", - "lane3": "0xffffffec", - "lane4": "0xffffffec", - "lane5": "0xffffffec", - "lane6": "0xffffffec", - "lane7": "0xffffffec" - } - }, - "QSFP28-40GBASE-CR4-2M":{ - "main":{ - "lane0": "0x00000069", - "lane1": "0x00000069", - "lane2": "0x00000069", - "lane3": "0x00000069", - "lane4": "0x00000069", - "lane5": "0x00000069", - "lane6": "0x00000069", - "lane7": "0x00000069" - }, - "post1":{ + "post1":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -8721,7 +7997,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -8753,7 +8029,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -8815,7 +8091,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x00000044", + "lane1": "0x00000044", + "lane2": "0x00000046", + "lane3": "0x00000040", + "lane4": "0x00000044", + "lane5": "0x00000044", + "lane6": "0x00000046", + "lane7": "0x00000040" + }, + "post1":{ + "lane0": "0xfffffff0", + "lane1": "0xfffffff4", + "lane2": "0xfffffff0", + "lane3": "0xfffffff4", + "lane4": "0xfffffff0", + "lane5": "0xfffffff4", + "lane6": "0xfffffff0", + "lane7": "0xfffffff4" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -8847,7 +8155,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -8879,7 +8187,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -8911,7 +8219,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -8943,7 +8251,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -8974,10 +8282,42 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } + }, + "QSFP+-*":{ + "main":{ + "lane0": "0x00000046", + "lane1": "0x00000046", + "lane2": "0x00000046", + "lane3": "0x00000046", + "lane4": "0x00000046", + "lane5": "0x00000046", + "lane6": "0x00000046", + "lane7": "0x00000046" + }, + "post1":{ + "lane0": "0xfffffff4", + "lane1": "0xfffffff4", + "lane2": "0xfffffff4", + "lane3": "0xfffffff4", + "lane4": "0xfffffff4", + "lane5": "0xfffffff4", + "lane6": "0xfffffff4", + "lane7": "0xfffffff4" + }, + "pre1":{ + "lane0": "0xfffffffe", + "lane1": "0xfffffffe", + "lane2": "0xfffffffe", + "lane3": "0xfffffffe", + "lane4": "0xfffffffe", + "lane5": "0xfffffffe", + "lane6": "0xfffffffe", + "lane7": "0xfffffffe" + } } }, - "12":{ - "Amphenol-NDVYYF-0001":{ + "12":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -9039,7 +8379,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -9101,7 +8441,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -9163,7 +8503,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -9225,131 +8565,7 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x0000008c", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "ONET-1AT-5QAM15XX-10A":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -9411,7 +8627,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -9473,7 +8689,7 @@ "lane7": "0xfffffff0" } }, - "QSFP28-40GBASE-CR4-1M":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -9505,7 +8721,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-2M":{ + "QSFP28-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -9537,7 +8753,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -9569,7 +8785,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -9631,7 +8847,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x00000040", + "lane1": "0x00000044", + "lane2": "0x0000003a", + "lane3": "0x0000003c", + "lane4": "0x00000040", + "lane5": "0x00000044", + "lane6": "0x0000003a", + "lane7": "0x0000003c" + }, + "post1":{ + "lane0": "0xfffffff0", + "lane1": "0xfffffff0", + "lane2": "0xfffffff6", + "lane3": "0xfffffff4", + "lane4": "0xfffffff0", + "lane5": "0xfffffff0", + "lane6": "0xfffffff6", + "lane7": "0xfffffff4" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -9663,7 +8911,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -9695,7 +8943,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -9727,7 +8975,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -9759,7 +9007,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -9790,10 +9038,42 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } + }, + "QSFP+-*":{ + "main":{ + "lane0": "0x00000046", + "lane1": "0x00000046", + "lane2": "0x00000046", + "lane3": "0x00000046", + "lane4": "0x00000046", + "lane5": "0x00000046", + "lane6": "0x00000046", + "lane7": "0x00000046" + }, + "post1":{ + "lane0": "0xfffffff4", + "lane1": "0xfffffff4", + "lane2": "0xfffffff4", + "lane3": "0xfffffff4", + "lane4": "0xfffffff4", + "lane5": "0xfffffff4", + "lane6": "0xfffffff4", + "lane7": "0xfffffff4" + }, + "pre1":{ + "lane0": "0xfffffffe", + "lane1": "0xfffffffe", + "lane2": "0xfffffffe", + "lane3": "0xfffffffe", + "lane4": "0xfffffffe", + "lane5": "0xfffffffe", + "lane6": "0xfffffffe", + "lane7": "0xfffffffe" + } } }, - "13":{ - "Amphenol-NDVYYF-0001":{ + "13":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -9855,7 +9135,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -9917,7 +9197,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -9979,7 +9259,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -10041,18 +9321,18 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", - "lane2": "0x0000008c", + "lane2": "0x00000088", "lane3": "0x00000088", "lane4": "0x00000088", "lane5": "0x00000088", "lane6": "0x00000088", "lane7": "0x00000088" }, - "post1":{ + "post2":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -10062,7 +9342,7 @@ "lane6": "0x00000000", "lane7": "0x00000000" }, - "post2":{ + "post3":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -10072,131 +9352,7 @@ "lane6": "0x00000000", "lane7": "0x00000000" }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "ONET-1AT-5QAM15XX-10A":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ + "pre2":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -10227,7 +9383,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -10289,7 +9445,7 @@ "lane7": "0xfffffff0" } }, - "QSFP28-40GBASE-CR4-1M":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -10321,7 +9477,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-2M":{ + "QSFP28-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -10353,7 +9509,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -10385,7 +9541,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -10447,7 +9603,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x0000003c", + "lane1": "0x0000003a", + "lane2": "0x00000036", + "lane3": "0x0000003a", + "lane4": "0x0000003c", + "lane5": "0x0000003a", + "lane6": "0x00000036", + "lane7": "0x0000003a" + }, + "post1":{ + "lane0": "0xfffffff8", + "lane1": "0xfffffff6", + "lane2": "0xfffffff8", + "lane3": "0xfffffff6", + "lane4": "0xfffffff8", + "lane5": "0xfffffff6", + "lane6": "0xfffffff8", + "lane7": "0xfffffff6" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -10479,7 +9667,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -10511,7 +9699,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -10543,7 +9731,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -10575,7 +9763,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -10606,10 +9794,42 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } + }, + "QSFP+-*":{ + "main":{ + "lane0": "0x00000044", + "lane1": "0x00000044", + "lane2": "0x00000044", + "lane3": "0x00000044", + "lane4": "0x00000044", + "lane5": "0x00000044", + "lane6": "0x00000044", + "lane7": "0x00000044" + }, + "post1":{ + "lane0": "0xfffffff8", + "lane1": "0xfffffff8", + "lane2": "0xfffffff8", + "lane3": "0xfffffff8", + "lane4": "0xfffffff8", + "lane5": "0xfffffff8", + "lane6": "0xfffffff8", + "lane7": "0xfffffff8" + }, + "pre1":{ + "lane0": "0x00000000", + "lane1": "0x00000000", + "lane2": "0x00000000", + "lane3": "0x00000000", + "lane4": "0x00000000", + "lane5": "0x00000000", + "lane6": "0x00000000", + "lane7": "0x00000000" + } } }, - "14":{ - "Amphenol-NDVYYF-0001":{ + "14":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -10671,7 +9891,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -10733,7 +9953,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -10795,7 +10015,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -10857,69 +10077,7 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x0000008c", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -10981,7 +10139,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM15XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -11043,18 +10201,18 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" + "lane0": "0x00000069", + "lane1": "0x00000069", + "lane2": "0x00000069", + "lane3": "0x00000069", + "lane4": "0x00000069", + "lane5": "0x00000069", + "lane6": "0x00000069", + "lane7": "0x00000069" }, - "post2":{ + "post1":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -11064,91 +10222,29 @@ "lane6": "0x00000000", "lane7": "0x00000000" }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" + "pre1":{ + "lane0": "0xffffffec", + "lane1": "0xffffffec", + "lane2": "0xffffffec", + "lane3": "0xffffffec", + "lane4": "0xffffffec", + "lane5": "0xffffffec", + "lane6": "0xffffffec", + "lane7": "0xffffffec" + } + }, + "QSFP28-40GBASE-CR4-2.0M":{ + "main":{ + "lane0": "0x00000069", + "lane1": "0x00000069", + "lane2": "0x00000069", + "lane3": "0x00000069", + "lane4": "0x00000069", + "lane5": "0x00000069", + "lane6": "0x00000069", + "lane7": "0x00000069" }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "QSFP28-40GBASE-CR4-1M":{ - "main":{ - "lane0": "0x00000069", - "lane1": "0x00000069", - "lane2": "0x00000069", - "lane3": "0x00000069", - "lane4": "0x00000069", - "lane5": "0x00000069", - "lane6": "0x00000069", - "lane7": "0x00000069" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffec", - "lane1": "0xffffffec", - "lane2": "0xffffffec", - "lane3": "0xffffffec", - "lane4": "0xffffffec", - "lane5": "0xffffffec", - "lane6": "0xffffffec", - "lane7": "0xffffffec" - } - }, - "QSFP28-40GBASE-CR4-2M":{ - "main":{ - "lane0": "0x00000069", - "lane1": "0x00000069", - "lane2": "0x00000069", - "lane3": "0x00000069", - "lane4": "0x00000069", - "lane5": "0x00000069", - "lane6": "0x00000069", - "lane7": "0x00000069" - }, - "post1":{ + "post1":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -11169,7 +10265,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -11201,7 +10297,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -11263,7 +10359,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x00000032", + "lane1": "0x00000040", + "lane2": "0x00000034", + "lane3": "0x00000032", + "lane4": "0x00000032", + "lane5": "0x00000040", + "lane6": "0x00000034", + "lane7": "0x00000032" + }, + "post1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffff8", + "lane2": "0xfffffff8", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffff8", + "lane6": "0xfffffff8", + "lane7": "0xfffffffc" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -11295,7 +10423,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -11327,7 +10455,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -11359,7 +10487,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -11391,7 +10519,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -11422,10 +10550,42 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } + }, + "QSFP+-*":{ + "main":{ + "lane0": "0x00000044", + "lane1": "0x00000044", + "lane2": "0x00000044", + "lane3": "0x00000044", + "lane4": "0x00000044", + "lane5": "0x00000044", + "lane6": "0x00000044", + "lane7": "0x00000044" + }, + "post1":{ + "lane0": "0xfffffff8", + "lane1": "0xfffffff8", + "lane2": "0xfffffff8", + "lane3": "0xfffffff8", + "lane4": "0xfffffff8", + "lane5": "0xfffffff8", + "lane6": "0xfffffff8", + "lane7": "0xfffffff8" + }, + "pre1":{ + "lane0": "0x00000000", + "lane1": "0x00000000", + "lane2": "0x00000000", + "lane3": "0x00000000", + "lane4": "0x00000000", + "lane5": "0x00000000", + "lane6": "0x00000000", + "lane7": "0x00000000" + } } }, - "15":{ - "Amphenol-NDVYYF-0001":{ + "15":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -11487,7 +10647,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -11549,7 +10709,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -11611,7 +10771,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -11673,131 +10833,7 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x0000008c", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "ONET-1AT-5QAM15XX-10A":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -11859,7 +10895,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -11921,7 +10957,7 @@ "lane7": "0xfffffff0" } }, - "QSFP28-40GBASE-CR4-1M":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -11953,7 +10989,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-2M":{ + "QSFP28-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -11985,7 +11021,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -12017,7 +11053,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -12079,7 +11115,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x00000032", + "lane1": "0x00000034", + "lane2": "0x00000030", + "lane3": "0x00000032", + "lane4": "0x00000032", + "lane5": "0x00000034", + "lane6": "0x00000030", + "lane7": "0x00000032" + }, + "post1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -12111,7 +11179,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -12143,7 +11211,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -12175,7 +11243,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -12207,7 +11275,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -12238,10 +11306,42 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } + }, + "QSFP+-*":{ + "main":{ + "lane0": "0x00000044", + "lane1": "0x00000044", + "lane2": "0x00000044", + "lane3": "0x00000044", + "lane4": "0x00000044", + "lane5": "0x00000044", + "lane6": "0x00000044", + "lane7": "0x00000044" + }, + "post1":{ + "lane0": "0xfffffff8", + "lane1": "0xfffffff8", + "lane2": "0xfffffff8", + "lane3": "0xfffffff8", + "lane4": "0xfffffff8", + "lane5": "0xfffffff8", + "lane6": "0xfffffff8", + "lane7": "0xfffffff8" + }, + "pre1":{ + "lane0": "0x00000000", + "lane1": "0x00000000", + "lane2": "0x00000000", + "lane3": "0x00000000", + "lane4": "0x00000000", + "lane5": "0x00000000", + "lane6": "0x00000000", + "lane7": "0x00000000" + } } }, - "16":{ - "Amphenol-NDVYYF-0001":{ + "16":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -12303,7 +11403,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -12365,7 +11465,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -12427,7 +11527,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -12489,18 +11589,18 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", - "lane2": "0x0000008c", + "lane2": "0x00000088", "lane3": "0x00000088", "lane4": "0x00000088", "lane5": "0x00000088", "lane6": "0x00000088", "lane7": "0x00000088" }, - "post1":{ + "post2":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -12510,7 +11610,7 @@ "lane6": "0x00000000", "lane7": "0x00000000" }, - "post2":{ + "post3":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -12520,131 +11620,7 @@ "lane6": "0x00000000", "lane7": "0x00000000" }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "ONET-1AT-5QAM15XX-10A":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ + "pre2":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -12675,7 +11651,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -12737,7 +11713,7 @@ "lane7": "0xfffffff0" } }, - "QSFP28-40GBASE-CR4-1M":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -12769,7 +11745,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-2M":{ + "QSFP28-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -12801,7 +11777,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -12833,7 +11809,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -12895,7 +11871,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x00000030", + "lane1": "0x00000032", + "lane2": "0x0000002c", + "lane3": "0x0000002c", + "lane4": "0x00000030", + "lane5": "0x00000032", + "lane6": "0x0000002c", + "lane7": "0x0000002c" + }, + "post1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -12927,7 +11935,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -12959,7 +11967,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -12991,7 +11999,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -13023,7 +12031,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -13054,10 +12062,42 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } + }, + "QSFP+-*":{ + "main":{ + "lane0": "0x00000044", + "lane1": "0x00000044", + "lane2": "0x00000044", + "lane3": "0x00000044", + "lane4": "0x00000044", + "lane5": "0x00000044", + "lane6": "0x00000044", + "lane7": "0x00000044" + }, + "post1":{ + "lane0": "0xfffffff8", + "lane1": "0xfffffff8", + "lane2": "0xfffffff8", + "lane3": "0xfffffff8", + "lane4": "0xfffffff8", + "lane5": "0xfffffff8", + "lane6": "0xfffffff8", + "lane7": "0xfffffff8" + }, + "pre1":{ + "lane0": "0x00000000", + "lane1": "0x00000000", + "lane2": "0x00000000", + "lane3": "0x00000000", + "lane4": "0x00000000", + "lane5": "0x00000000", + "lane6": "0x00000000", + "lane7": "0x00000000" + } } }, - "17":{ - "Amphenol-NDVYYF-0001":{ + "17":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -13119,7 +12159,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -13181,7 +12221,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -13243,7 +12283,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -13305,69 +12345,7 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x0000008c", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -13429,7 +12407,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM15XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -13491,18 +12469,18 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" + "lane0": "0x00000069", + "lane1": "0x00000069", + "lane2": "0x00000069", + "lane3": "0x00000069", + "lane4": "0x00000069", + "lane5": "0x00000069", + "lane6": "0x00000069", + "lane7": "0x00000069" }, - "post2":{ + "post1":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -13512,91 +12490,29 @@ "lane6": "0x00000000", "lane7": "0x00000000" }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" + "pre1":{ + "lane0": "0xffffffec", + "lane1": "0xffffffec", + "lane2": "0xffffffec", + "lane3": "0xffffffec", + "lane4": "0xffffffec", + "lane5": "0xffffffec", + "lane6": "0xffffffec", + "lane7": "0xffffffec" + } + }, + "QSFP28-40GBASE-CR4-2.0M":{ + "main":{ + "lane0": "0x00000069", + "lane1": "0x00000069", + "lane2": "0x00000069", + "lane3": "0x00000069", + "lane4": "0x00000069", + "lane5": "0x00000069", + "lane6": "0x00000069", + "lane7": "0x00000069" }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "QSFP28-40GBASE-CR4-1M":{ - "main":{ - "lane0": "0x00000069", - "lane1": "0x00000069", - "lane2": "0x00000069", - "lane3": "0x00000069", - "lane4": "0x00000069", - "lane5": "0x00000069", - "lane6": "0x00000069", - "lane7": "0x00000069" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffec", - "lane1": "0xffffffec", - "lane2": "0xffffffec", - "lane3": "0xffffffec", - "lane4": "0xffffffec", - "lane5": "0xffffffec", - "lane6": "0xffffffec", - "lane7": "0xffffffec" - } - }, - "QSFP28-40GBASE-CR4-2M":{ - "main":{ - "lane0": "0x00000069", - "lane1": "0x00000069", - "lane2": "0x00000069", - "lane3": "0x00000069", - "lane4": "0x00000069", - "lane5": "0x00000069", - "lane6": "0x00000069", - "lane7": "0x00000069" - }, - "post1":{ + "post1":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -13617,7 +12533,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -13649,7 +12565,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -13711,7 +12627,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x00000036", + "lane1": "0x00000032", + "lane2": "0x00000030", + "lane3": "0x00000030", + "lane4": "0x00000036", + "lane5": "0x00000032", + "lane6": "0x00000030", + "lane7": "0x00000030" + }, + "post1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -13743,7 +12691,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -13775,7 +12723,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -13807,7 +12755,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -13839,7 +12787,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -13870,10 +12818,42 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } + }, + "QSFP+-*":{ + "main":{ + "lane0": "0x00000044", + "lane1": "0x00000044", + "lane2": "0x00000044", + "lane3": "0x00000044", + "lane4": "0x00000044", + "lane5": "0x00000044", + "lane6": "0x00000044", + "lane7": "0x00000044" + }, + "post1":{ + "lane0": "0xfffffff8", + "lane1": "0xfffffff8", + "lane2": "0xfffffff8", + "lane3": "0xfffffff8", + "lane4": "0xfffffff8", + "lane5": "0xfffffff8", + "lane6": "0xfffffff8", + "lane7": "0xfffffff8" + }, + "pre1":{ + "lane0": "0x00000000", + "lane1": "0x00000000", + "lane2": "0x00000000", + "lane3": "0x00000000", + "lane4": "0x00000000", + "lane5": "0x00000000", + "lane6": "0x00000000", + "lane7": "0x00000000" + } } }, - "18":{ - "Amphenol-NDVYYF-0001":{ + "18":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -13935,7 +12915,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -13997,7 +12977,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -14059,7 +13039,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -14121,131 +13101,7 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x0000008c", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "ONET-1AT-5QAM15XX-10A":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -14307,7 +13163,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -14369,7 +13225,7 @@ "lane7": "0xfffffff0" } }, - "QSFP28-40GBASE-CR4-1M":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -14401,7 +13257,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-2M":{ + "QSFP28-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -14433,7 +13289,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -14465,7 +13321,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -14527,7 +13383,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x00000030", + "lane1": "0x00000036", + "lane2": "0x00000032", + "lane3": "0x00000032", + "lane4": "0x00000030", + "lane5": "0x00000036", + "lane6": "0x00000032", + "lane7": "0x00000032" + }, + "post1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -14559,7 +13447,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -14591,7 +13479,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -14623,7 +13511,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -14655,7 +13543,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -14686,10 +13574,42 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } + }, + "QSFP+-*":{ + "main":{ + "lane0": "0x00000044", + "lane1": "0x00000044", + "lane2": "0x00000044", + "lane3": "0x00000044", + "lane4": "0x00000044", + "lane5": "0x00000044", + "lane6": "0x00000044", + "lane7": "0x00000044" + }, + "post1":{ + "lane0": "0xfffffff8", + "lane1": "0xfffffff8", + "lane2": "0xfffffff8", + "lane3": "0xfffffff8", + "lane4": "0xfffffff8", + "lane5": "0xfffffff8", + "lane6": "0xfffffff8", + "lane7": "0xfffffff8" + }, + "pre1":{ + "lane0": "0x00000000", + "lane1": "0x00000000", + "lane2": "0x00000000", + "lane3": "0x00000000", + "lane4": "0x00000000", + "lane5": "0x00000000", + "lane6": "0x00000000", + "lane7": "0x00000000" + } } }, - "19":{ - "Amphenol-NDVYYF-0001":{ + "19":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -14751,7 +13671,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -14813,7 +13733,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -14875,7 +13795,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -14937,18 +13857,18 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", - "lane2": "0x0000008c", + "lane2": "0x00000088", "lane3": "0x00000088", "lane4": "0x00000088", "lane5": "0x00000088", "lane6": "0x00000088", "lane7": "0x00000088" }, - "post1":{ + "post2":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -14958,7 +13878,7 @@ "lane6": "0x00000000", "lane7": "0x00000000" }, - "post2":{ + "post3":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -14968,7 +13888,7 @@ "lane6": "0x00000000", "lane7": "0x00000000" }, - "post3":{ + "pre2":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -14977,140 +13897,16 @@ "lane5": "0x00000000", "lane6": "0x00000000", "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "ONET-1AT-5QAM15XX-10A":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" + }, + "post1":{ + "lane0": "0xfffffff0", + "lane1": "0xfffffff0", + "lane2": "0xfffffff0", + "lane3": "0xfffffff0", + "lane4": "0xfffffff0", + "lane5": "0xfffffff0", + "lane6": "0xfffffff0", + "lane7": "0xfffffff0" }, "pre1":{ "lane0": "0xfffffff0", @@ -15123,7 +13919,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -15185,7 +13981,7 @@ "lane7": "0xfffffff0" } }, - "QSFP28-40GBASE-CR4-1M":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -15217,7 +14013,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-2M":{ + "QSFP28-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -15249,7 +14045,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -15281,7 +14077,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -15343,7 +14139,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x00000036", + "lane1": "0x00000038", + "lane2": "0x00000032", + "lane3": "0x00000032", + "lane4": "0x00000036", + "lane5": "0x00000038", + "lane6": "0x00000032", + "lane7": "0x00000032" + }, + "post1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -15375,7 +14203,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -15407,7 +14235,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -15439,7 +14267,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -15471,7 +14299,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -15502,10 +14330,42 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } + }, + "QSFP+-*":{ + "main":{ + "lane0": "0x00000044", + "lane1": "0x00000044", + "lane2": "0x00000044", + "lane3": "0x00000044", + "lane4": "0x00000044", + "lane5": "0x00000044", + "lane6": "0x00000044", + "lane7": "0x00000044" + }, + "post1":{ + "lane0": "0xfffffff8", + "lane1": "0xfffffff8", + "lane2": "0xfffffff8", + "lane3": "0xfffffff8", + "lane4": "0xfffffff8", + "lane5": "0xfffffff8", + "lane6": "0xfffffff8", + "lane7": "0xfffffff8" + }, + "pre1":{ + "lane0": "0x00000000", + "lane1": "0x00000000", + "lane2": "0x00000000", + "lane3": "0x00000000", + "lane4": "0x00000000", + "lane5": "0x00000000", + "lane6": "0x00000000", + "lane7": "0x00000000" + } } }, - "20":{ - "Amphenol-NDVYYF-0001":{ + "20":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -15567,7 +14427,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -15629,7 +14489,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -15691,7 +14551,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -15753,69 +14613,7 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x0000008c", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -15877,7 +14675,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM15XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -15939,18 +14737,18 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" + "lane0": "0x00000069", + "lane1": "0x00000069", + "lane2": "0x00000069", + "lane3": "0x00000069", + "lane4": "0x00000069", + "lane5": "0x00000069", + "lane6": "0x00000069", + "lane7": "0x00000069" }, - "post2":{ + "post1":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -15960,91 +14758,29 @@ "lane6": "0x00000000", "lane7": "0x00000000" }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "QSFP28-40GBASE-CR4-1M":{ - "main":{ - "lane0": "0x00000069", - "lane1": "0x00000069", - "lane2": "0x00000069", - "lane3": "0x00000069", - "lane4": "0x00000069", - "lane5": "0x00000069", - "lane6": "0x00000069", - "lane7": "0x00000069" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffec", - "lane1": "0xffffffec", - "lane2": "0xffffffec", - "lane3": "0xffffffec", - "lane4": "0xffffffec", - "lane5": "0xffffffec", - "lane6": "0xffffffec", - "lane7": "0xffffffec" - } - }, - "QSFP28-40GBASE-CR4-2M":{ - "main":{ - "lane0": "0x00000069", - "lane1": "0x00000069", - "lane2": "0x00000069", - "lane3": "0x00000069", - "lane4": "0x00000069", - "lane5": "0x00000069", - "lane6": "0x00000069", - "lane7": "0x00000069" - }, - "post1":{ + "pre1":{ + "lane0": "0xffffffec", + "lane1": "0xffffffec", + "lane2": "0xffffffec", + "lane3": "0xffffffec", + "lane4": "0xffffffec", + "lane5": "0xffffffec", + "lane6": "0xffffffec", + "lane7": "0xffffffec" + } + }, + "QSFP28-40GBASE-CR4-2.0M":{ + "main":{ + "lane0": "0x00000069", + "lane1": "0x00000069", + "lane2": "0x00000069", + "lane3": "0x00000069", + "lane4": "0x00000069", + "lane5": "0x00000069", + "lane6": "0x00000069", + "lane7": "0x00000069" + }, + "post1":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -16065,7 +14801,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -16097,7 +14833,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -16159,7 +14895,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x0000003a", + "lane1": "0x0000003a", + "lane2": "0x00000034", + "lane3": "0x00000036", + "lane4": "0x0000003a", + "lane5": "0x0000003a", + "lane6": "0x00000034", + "lane7": "0x00000036" + }, + "post1":{ + "lane0": "0xfffffff6", + "lane1": "0xfffffff6", + "lane2": "0xfffffff8", + "lane3": "0xfffffffc", + "lane4": "0xfffffff6", + "lane5": "0xfffffff6", + "lane6": "0xfffffff8", + "lane7": "0xfffffffc" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -16191,7 +14959,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -16223,7 +14991,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -16255,7 +15023,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -16287,7 +15055,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -16318,10 +15086,42 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } + }, + "QSFP+-*":{ + "main":{ + "lane0": "0x00000044", + "lane1": "0x00000044", + "lane2": "0x00000044", + "lane3": "0x00000044", + "lane4": "0x00000044", + "lane5": "0x00000044", + "lane6": "0x00000044", + "lane7": "0x00000044" + }, + "post1":{ + "lane0": "0xfffffff8", + "lane1": "0xfffffff8", + "lane2": "0xfffffff8", + "lane3": "0xfffffff8", + "lane4": "0xfffffff8", + "lane5": "0xfffffff8", + "lane6": "0xfffffff8", + "lane7": "0xfffffff8" + }, + "pre1":{ + "lane0": "0x00000000", + "lane1": "0x00000000", + "lane2": "0x00000000", + "lane3": "0x00000000", + "lane4": "0x00000000", + "lane5": "0x00000000", + "lane6": "0x00000000", + "lane7": "0x00000000" + } } }, - "21":{ - "Amphenol-NDVYYF-0001":{ + "21":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -16383,7 +15183,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -16445,7 +15245,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -16507,7 +15307,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -16569,131 +15369,7 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x0000008c", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "ONET-1AT-5QAM15XX-10A":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -16755,7 +15431,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -16817,7 +15493,7 @@ "lane7": "0xfffffff0" } }, - "QSFP28-40GBASE-CR4-1M":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -16849,7 +15525,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-2M":{ + "QSFP28-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -16881,7 +15557,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -16913,7 +15589,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -16975,7 +15651,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x00000048", + "lane1": "0x00000044", + "lane2": "0x00000044", + "lane3": "0x00000040", + "lane4": "0x00000048", + "lane5": "0x00000044", + "lane6": "0x00000044", + "lane7": "0x00000040" + }, + "post1":{ + "lane0": "0xfffffff0", + "lane1": "0xfffffff0", + "lane2": "0xfffffff4", + "lane3": "0xfffffff6", + "lane4": "0xfffffff0", + "lane5": "0xfffffff0", + "lane6": "0xfffffff4", + "lane7": "0xfffffff6" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -17007,7 +15715,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -17039,7 +15747,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -17071,7 +15779,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -17103,7 +15811,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -17134,10 +15842,42 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } + }, + "QSFP+-*":{ + "main":{ + "lane0": "0x00000046", + "lane1": "0x00000046", + "lane2": "0x00000046", + "lane3": "0x00000046", + "lane4": "0x00000046", + "lane5": "0x00000046", + "lane6": "0x00000046", + "lane7": "0x00000046" + }, + "post1":{ + "lane0": "0xfffffff4", + "lane1": "0xfffffff4", + "lane2": "0xfffffff4", + "lane3": "0xfffffff4", + "lane4": "0xfffffff4", + "lane5": "0xfffffff4", + "lane6": "0xfffffff4", + "lane7": "0xfffffff4" + }, + "pre1":{ + "lane0": "0xfffffffe", + "lane1": "0xfffffffe", + "lane2": "0xfffffffe", + "lane3": "0xfffffffe", + "lane4": "0xfffffffe", + "lane5": "0xfffffffe", + "lane6": "0xfffffffe", + "lane7": "0xfffffffe" + } } }, - "22":{ - "Amphenol-NDVYYF-0001":{ + "22":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -17199,7 +15939,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -17261,7 +16001,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -17323,7 +16063,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -17385,135 +16125,11 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", - "lane2": "0x0000008c", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "ONET-1AT-5QAM15XX-10A":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", + "lane2": "0x00000088", "lane3": "0x00000088", "lane4": "0x00000088", "lane5": "0x00000088", @@ -17571,7 +16187,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -17633,7 +16249,7 @@ "lane7": "0xfffffff0" } }, - "QSFP28-40GBASE-CR4-1M":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -17665,7 +16281,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-2M":{ + "QSFP28-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -17697,7 +16313,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -17729,7 +16345,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -17791,7 +16407,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x00000044", + "lane1": "0x00000044", + "lane2": "0x00000042", + "lane3": "0x00000044", + "lane4": "0x00000044", + "lane5": "0x00000044", + "lane6": "0x00000042", + "lane7": "0x00000044" + }, + "post1":{ + "lane0": "0xfffffff0", + "lane1": "0xfffffff0", + "lane2": "0xfffffff0", + "lane3": "0xfffffff0", + "lane4": "0xfffffff0", + "lane5": "0xfffffff0", + "lane6": "0xfffffff0", + "lane7": "0xfffffff0" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -17823,7 +16471,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -17855,7 +16503,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -17887,7 +16535,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -17919,7 +16567,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -17950,10 +16598,42 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } + }, + "QSFP+-*":{ + "main":{ + "lane0": "0x00000046", + "lane1": "0x00000046", + "lane2": "0x00000046", + "lane3": "0x00000046", + "lane4": "0x00000046", + "lane5": "0x00000046", + "lane6": "0x00000046", + "lane7": "0x00000046" + }, + "post1":{ + "lane0": "0xfffffff4", + "lane1": "0xfffffff4", + "lane2": "0xfffffff4", + "lane3": "0xfffffff4", + "lane4": "0xfffffff4", + "lane5": "0xfffffff4", + "lane6": "0xfffffff4", + "lane7": "0xfffffff4" + }, + "pre1":{ + "lane0": "0xfffffffe", + "lane1": "0xfffffffe", + "lane2": "0xfffffffe", + "lane3": "0xfffffffe", + "lane4": "0xfffffffe", + "lane5": "0xfffffffe", + "lane6": "0xfffffffe", + "lane7": "0xfffffffe" + } } }, - "23":{ - "Amphenol-NDVYYF-0001":{ + "23":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -18015,7 +16695,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -18077,7 +16757,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -18139,7 +16819,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -18201,69 +16881,7 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x0000008c", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -18325,7 +16943,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM15XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -18387,18 +17005,18 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" + "lane0": "0x00000069", + "lane1": "0x00000069", + "lane2": "0x00000069", + "lane3": "0x00000069", + "lane4": "0x00000069", + "lane5": "0x00000069", + "lane6": "0x00000069", + "lane7": "0x00000069" }, - "post2":{ + "post1":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -18408,91 +17026,29 @@ "lane6": "0x00000000", "lane7": "0x00000000" }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "QSFP28-40GBASE-CR4-1M":{ - "main":{ - "lane0": "0x00000069", - "lane1": "0x00000069", - "lane2": "0x00000069", - "lane3": "0x00000069", - "lane4": "0x00000069", - "lane5": "0x00000069", - "lane6": "0x00000069", - "lane7": "0x00000069" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffec", - "lane1": "0xffffffec", - "lane2": "0xffffffec", - "lane3": "0xffffffec", - "lane4": "0xffffffec", - "lane5": "0xffffffec", - "lane6": "0xffffffec", - "lane7": "0xffffffec" - } - }, - "QSFP28-40GBASE-CR4-2M":{ - "main":{ - "lane0": "0x00000069", - "lane1": "0x00000069", - "lane2": "0x00000069", - "lane3": "0x00000069", - "lane4": "0x00000069", - "lane5": "0x00000069", - "lane6": "0x00000069", - "lane7": "0x00000069" - }, - "post1":{ + "pre1":{ + "lane0": "0xffffffec", + "lane1": "0xffffffec", + "lane2": "0xffffffec", + "lane3": "0xffffffec", + "lane4": "0xffffffec", + "lane5": "0xffffffec", + "lane6": "0xffffffec", + "lane7": "0xffffffec" + } + }, + "QSFP28-40GBASE-CR4-2.0M":{ + "main":{ + "lane0": "0x00000069", + "lane1": "0x00000069", + "lane2": "0x00000069", + "lane3": "0x00000069", + "lane4": "0x00000069", + "lane5": "0x00000069", + "lane6": "0x00000069", + "lane7": "0x00000069" + }, + "post1":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -18513,7 +17069,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -18545,7 +17101,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -18607,7 +17163,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x00000048", + "lane1": "0x00000042", + "lane2": "0x00000044", + "lane3": "0x00000044", + "lane4": "0x00000048", + "lane5": "0x00000042", + "lane6": "0x00000044", + "lane7": "0x00000044" + }, + "post1":{ + "lane0": "0xffffffec", + "lane1": "0xfffffff6", + "lane2": "0xfffffff4", + "lane3": "0xfffffff6", + "lane4": "0xffffffec", + "lane5": "0xfffffff6", + "lane6": "0xfffffff4", + "lane7": "0xfffffff6" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -18639,7 +17227,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -18671,7 +17259,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -18703,7 +17291,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -18735,7 +17323,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -18766,10 +17354,42 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } + }, + "QSFP+-*":{ + "main":{ + "lane0": "0x0000004a", + "lane1": "0x0000004a", + "lane2": "0x0000004a", + "lane3": "0x0000004a", + "lane4": "0x0000004a", + "lane5": "0x0000004a", + "lane6": "0x0000004a", + "lane7": "0x0000004a" + }, + "post1":{ + "lane0": "0xfffffff2", + "lane1": "0xfffffff2", + "lane2": "0xfffffff2", + "lane3": "0xfffffff2", + "lane4": "0xfffffff2", + "lane5": "0xfffffff2", + "lane6": "0xfffffff2", + "lane7": "0xfffffff2" + }, + "pre1":{ + "lane0": "0xfffffffe", + "lane1": "0xfffffffe", + "lane2": "0xfffffffe", + "lane3": "0xfffffffe", + "lane4": "0xfffffffe", + "lane5": "0xfffffffe", + "lane6": "0xfffffffe", + "lane7": "0xfffffffe" + } } }, - "24":{ - "Amphenol-NDVYYF-0001":{ + "24":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -18831,7 +17451,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -18893,7 +17513,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -18955,7 +17575,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -19017,131 +17637,7 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x0000008c", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "ONET-1AT-5QAM15XX-10A":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -19203,7 +17699,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -19265,7 +17761,7 @@ "lane7": "0xfffffff0" } }, - "QSFP28-40GBASE-CR4-1M":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -19297,7 +17793,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-2M":{ + "QSFP28-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -19329,7 +17825,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -19361,7 +17857,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -19423,7 +17919,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x00000040", + "lane1": "0x00000048", + "lane2": "0x00000040", + "lane3": "0x00000044", + "lane4": "0x00000040", + "lane5": "0x00000048", + "lane6": "0x00000040", + "lane7": "0x00000044" + }, + "post1":{ + "lane0": "0xfffffff0", + "lane1": "0xfffffff4", + "lane2": "0xfffffff6", + "lane3": "0xfffffff4", + "lane4": "0xfffffff0", + "lane5": "0xfffffff4", + "lane6": "0xfffffff6", + "lane7": "0xfffffff4" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -19455,7 +17983,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -19487,7 +18015,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -19519,7 +18047,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -19551,7 +18079,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -19582,10 +18110,42 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } + }, + "QSFP+-*":{ + "main":{ + "lane0": "0x0000004a", + "lane1": "0x0000004a", + "lane2": "0x0000004a", + "lane3": "0x0000004a", + "lane4": "0x0000004a", + "lane5": "0x0000004a", + "lane6": "0x0000004a", + "lane7": "0x0000004a" + }, + "post1":{ + "lane0": "0xfffffff2", + "lane1": "0xfffffff2", + "lane2": "0xfffffff2", + "lane3": "0xfffffff2", + "lane4": "0xfffffff2", + "lane5": "0xfffffff2", + "lane6": "0xfffffff2", + "lane7": "0xfffffff2" + }, + "pre1":{ + "lane0": "0xfffffffe", + "lane1": "0xfffffffe", + "lane2": "0xfffffffe", + "lane3": "0xfffffffe", + "lane4": "0xfffffffe", + "lane5": "0xfffffffe", + "lane6": "0xfffffffe", + "lane7": "0xfffffffe" + } } }, - "25":{ - "Amphenol-NDVYYF-0001":{ + "25":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -19647,7 +18207,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -19709,7 +18269,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -19771,7 +18331,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -19833,135 +18393,11 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", - "lane2": "0x0000008c", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "ONET-1AT-5QAM15XX-10A":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", + "lane2": "0x00000088", "lane3": "0x00000088", "lane4": "0x00000088", "lane5": "0x00000088", @@ -20019,7 +18455,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -20081,7 +18517,7 @@ "lane7": "0xfffffff0" } }, - "QSFP28-40GBASE-CR4-1M":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -20113,7 +18549,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-2M":{ + "QSFP28-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -20145,7 +18581,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -20177,7 +18613,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -20239,7 +18675,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x00000042", + "lane1": "0x0000003c", + "lane2": "0x00000042", + "lane3": "0x0000003a", + "lane4": "0x00000042", + "lane5": "0x0000003c", + "lane6": "0x00000042", + "lane7": "0x0000003a" + }, + "post1":{ + "lane0": "0xfffffff4", + "lane1": "0xfffffff4", + "lane2": "0xfffffff8", + "lane3": "0xfffffff6", + "lane4": "0xfffffff4", + "lane5": "0xfffffff4", + "lane6": "0xfffffff8", + "lane7": "0xfffffff6" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -20271,7 +18739,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -20303,7 +18771,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -20335,7 +18803,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -20367,7 +18835,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -20398,10 +18866,42 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } + }, + "QSFP+-*":{ + "main":{ + "lane0": "0x00000046", + "lane1": "0x00000046", + "lane2": "0x00000046", + "lane3": "0x00000046", + "lane4": "0x00000046", + "lane5": "0x00000046", + "lane6": "0x00000046", + "lane7": "0x00000046" + }, + "post1":{ + "lane0": "0xfffffff4", + "lane1": "0xfffffff4", + "lane2": "0xfffffff4", + "lane3": "0xfffffff4", + "lane4": "0xfffffff4", + "lane5": "0xfffffff4", + "lane6": "0xfffffff4", + "lane7": "0xfffffff4" + }, + "pre1":{ + "lane0": "0xfffffffe", + "lane1": "0xfffffffe", + "lane2": "0xfffffffe", + "lane3": "0xfffffffe", + "lane4": "0xfffffffe", + "lane5": "0xfffffffe", + "lane6": "0xfffffffe", + "lane7": "0xfffffffe" + } } }, - "26":{ - "Amphenol-NDVYYF-0001":{ + "26":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -20463,7 +18963,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -20525,7 +19025,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -20587,7 +19087,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -20649,69 +19149,7 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x0000008c", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -20773,7 +19211,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM15XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -20835,18 +19273,18 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" + "lane0": "0x00000069", + "lane1": "0x00000069", + "lane2": "0x00000069", + "lane3": "0x00000069", + "lane4": "0x00000069", + "lane5": "0x00000069", + "lane6": "0x00000069", + "lane7": "0x00000069" }, - "post2":{ + "post1":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -20856,91 +19294,29 @@ "lane6": "0x00000000", "lane7": "0x00000000" }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "QSFP28-40GBASE-CR4-1M":{ - "main":{ - "lane0": "0x00000069", - "lane1": "0x00000069", - "lane2": "0x00000069", - "lane3": "0x00000069", - "lane4": "0x00000069", - "lane5": "0x00000069", - "lane6": "0x00000069", - "lane7": "0x00000069" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffec", - "lane1": "0xffffffec", - "lane2": "0xffffffec", - "lane3": "0xffffffec", - "lane4": "0xffffffec", - "lane5": "0xffffffec", - "lane6": "0xffffffec", - "lane7": "0xffffffec" - } - }, - "QSFP28-40GBASE-CR4-2M":{ - "main":{ - "lane0": "0x00000069", - "lane1": "0x00000069", - "lane2": "0x00000069", - "lane3": "0x00000069", - "lane4": "0x00000069", - "lane5": "0x00000069", - "lane6": "0x00000069", - "lane7": "0x00000069" - }, - "post1":{ + "pre1":{ + "lane0": "0xffffffec", + "lane1": "0xffffffec", + "lane2": "0xffffffec", + "lane3": "0xffffffec", + "lane4": "0xffffffec", + "lane5": "0xffffffec", + "lane6": "0xffffffec", + "lane7": "0xffffffec" + } + }, + "QSFP28-40GBASE-CR4-2.0M":{ + "main":{ + "lane0": "0x00000069", + "lane1": "0x00000069", + "lane2": "0x00000069", + "lane3": "0x00000069", + "lane4": "0x00000069", + "lane5": "0x00000069", + "lane6": "0x00000069", + "lane7": "0x00000069" + }, + "post1":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -20961,7 +19337,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -20993,7 +19369,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -21055,7 +19431,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x00000044", + "lane1": "0x00000042", + "lane2": "0x00000038", + "lane3": "0x0000003c", + "lane4": "0x00000044", + "lane5": "0x00000042", + "lane6": "0x00000038", + "lane7": "0x0000003c" + }, + "post1":{ + "lane0": "0xfffffff0", + "lane1": "0xfffffff6", + "lane2": "0xfffffff6", + "lane3": "0xfffffff8", + "lane4": "0xfffffff0", + "lane5": "0xfffffff6", + "lane6": "0xfffffff6", + "lane7": "0xfffffff8" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -21087,7 +19495,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -21119,7 +19527,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -21151,7 +19559,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -21183,7 +19591,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -21214,10 +19622,42 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } + }, + "QSFP+-*":{ + "main":{ + "lane0": "0x00000046", + "lane1": "0x00000046", + "lane2": "0x00000046", + "lane3": "0x00000046", + "lane4": "0x00000046", + "lane5": "0x00000046", + "lane6": "0x00000046", + "lane7": "0x00000046" + }, + "post1":{ + "lane0": "0xfffffff4", + "lane1": "0xfffffff4", + "lane2": "0xfffffff4", + "lane3": "0xfffffff4", + "lane4": "0xfffffff4", + "lane5": "0xfffffff4", + "lane6": "0xfffffff4", + "lane7": "0xfffffff4" + }, + "pre1":{ + "lane0": "0xfffffffe", + "lane1": "0xfffffffe", + "lane2": "0xfffffffe", + "lane3": "0xfffffffe", + "lane4": "0xfffffffe", + "lane5": "0xfffffffe", + "lane6": "0xfffffffe", + "lane7": "0xfffffffe" + } } }, - "27":{ - "Amphenol-NDVYYF-0001":{ + "27":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -21279,7 +19719,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -21341,7 +19781,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -21403,7 +19843,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -21465,131 +19905,7 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x0000008c", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "ONET-1AT-5QAM15XX-10A":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -21651,7 +19967,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -21713,7 +20029,7 @@ "lane7": "0xfffffff0" } }, - "QSFP28-40GBASE-CR4-1M":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -21745,7 +20061,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-2M":{ + "QSFP28-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -21777,7 +20093,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -21809,7 +20125,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -21871,7 +20187,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x00000040", + "lane1": "0x00000044", + "lane2": "0x00000040", + "lane3": "0x00000040", + "lane4": "0x00000040", + "lane5": "0x00000044", + "lane6": "0x00000040", + "lane7": "0x00000040" + }, + "post1":{ + "lane0": "0xfffffff4", + "lane1": "0xfffffff0", + "lane2": "0xfffffff8", + "lane3": "0xfffffff8", + "lane4": "0xfffffff4", + "lane5": "0xfffffff0", + "lane6": "0xfffffff8", + "lane7": "0xfffffff8" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -21903,7 +20251,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -21935,7 +20283,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -21967,7 +20315,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -21999,7 +20347,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -22030,10 +20378,42 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } + }, + "QSFP+-*":{ + "main":{ + "lane0": "0x00000046", + "lane1": "0x00000046", + "lane2": "0x00000046", + "lane3": "0x00000046", + "lane4": "0x00000046", + "lane5": "0x00000046", + "lane6": "0x00000046", + "lane7": "0x00000046" + }, + "post1":{ + "lane0": "0xfffffff4", + "lane1": "0xfffffff4", + "lane2": "0xfffffff4", + "lane3": "0xfffffff4", + "lane4": "0xfffffff4", + "lane5": "0xfffffff4", + "lane6": "0xfffffff4", + "lane7": "0xfffffff4" + }, + "pre1":{ + "lane0": "0xfffffffe", + "lane1": "0xfffffffe", + "lane2": "0xfffffffe", + "lane3": "0xfffffffe", + "lane4": "0xfffffffe", + "lane5": "0xfffffffe", + "lane6": "0xfffffffe", + "lane7": "0xfffffffe" + } } }, - "28":{ - "Amphenol-NDVYYF-0001":{ + "28":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -22095,7 +20475,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -22157,7 +20537,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -22219,7 +20599,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -22281,142 +20661,18 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", - "lane2": "0x0000008c", + "lane2": "0x00000088", "lane3": "0x00000088", "lane4": "0x00000088", "lane5": "0x00000088", "lane6": "0x00000088", "lane7": "0x00000088" }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "ONET-1AT-5QAM15XX-10A":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post2":{ + "post2":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -22467,7 +20723,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -22529,7 +20785,7 @@ "lane7": "0xfffffff0" } }, - "QSFP28-40GBASE-CR4-1M":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -22561,7 +20817,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-2M":{ + "QSFP28-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -22593,7 +20849,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -22625,7 +20881,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -22687,7 +20943,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x0000003e", + "lane1": "0x00000044", + "lane2": "0x00000040", + "lane3": "0x0000003c", + "lane4": "0x0000003e", + "lane5": "0x00000044", + "lane6": "0x00000040", + "lane7": "0x0000003c" + }, + "post1":{ + "lane0": "0xfffffff6", + "lane1": "0xfffffff8", + "lane2": "0xfffffff8", + "lane3": "0xfffffff8", + "lane4": "0xfffffff6", + "lane5": "0xfffffff8", + "lane6": "0xfffffff8", + "lane7": "0xfffffff8" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -22719,7 +21007,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -22751,7 +21039,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -22783,7 +21071,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -22815,7 +21103,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -22846,10 +21134,42 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } + }, + "QSFP+-*":{ + "main":{ + "lane0": "0x00000046", + "lane1": "0x00000046", + "lane2": "0x00000046", + "lane3": "0x00000046", + "lane4": "0x00000046", + "lane5": "0x00000046", + "lane6": "0x00000046", + "lane7": "0x00000046" + }, + "post1":{ + "lane0": "0xfffffff4", + "lane1": "0xfffffff4", + "lane2": "0xfffffff4", + "lane3": "0xfffffff4", + "lane4": "0xfffffff4", + "lane5": "0xfffffff4", + "lane6": "0xfffffff4", + "lane7": "0xfffffff4" + }, + "pre1":{ + "lane0": "0xfffffffe", + "lane1": "0xfffffffe", + "lane2": "0xfffffffe", + "lane3": "0xfffffffe", + "lane4": "0xfffffffe", + "lane5": "0xfffffffe", + "lane6": "0xfffffffe", + "lane7": "0xfffffffe" + } } }, - "29":{ - "Amphenol-NDVYYF-0001":{ + "29":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -22911,7 +21231,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -22973,7 +21293,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -23035,7 +21355,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -23097,69 +21417,7 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x0000008c", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -23221,7 +21479,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM15XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -23283,18 +21541,18 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" + "lane0": "0x00000069", + "lane1": "0x00000069", + "lane2": "0x00000069", + "lane3": "0x00000069", + "lane4": "0x00000069", + "lane5": "0x00000069", + "lane6": "0x00000069", + "lane7": "0x00000069" }, - "post2":{ + "post1":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -23304,91 +21562,29 @@ "lane6": "0x00000000", "lane7": "0x00000000" }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "QSFP28-40GBASE-CR4-1M":{ - "main":{ - "lane0": "0x00000069", - "lane1": "0x00000069", - "lane2": "0x00000069", - "lane3": "0x00000069", - "lane4": "0x00000069", - "lane5": "0x00000069", - "lane6": "0x00000069", - "lane7": "0x00000069" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffec", - "lane1": "0xffffffec", - "lane2": "0xffffffec", - "lane3": "0xffffffec", - "lane4": "0xffffffec", - "lane5": "0xffffffec", - "lane6": "0xffffffec", - "lane7": "0xffffffec" - } - }, - "QSFP28-40GBASE-CR4-2M":{ - "main":{ - "lane0": "0x00000069", - "lane1": "0x00000069", - "lane2": "0x00000069", - "lane3": "0x00000069", - "lane4": "0x00000069", - "lane5": "0x00000069", - "lane6": "0x00000069", - "lane7": "0x00000069" - }, - "post1":{ + "pre1":{ + "lane0": "0xffffffec", + "lane1": "0xffffffec", + "lane2": "0xffffffec", + "lane3": "0xffffffec", + "lane4": "0xffffffec", + "lane5": "0xffffffec", + "lane6": "0xffffffec", + "lane7": "0xffffffec" + } + }, + "QSFP28-40GBASE-CR4-2.0M":{ + "main":{ + "lane0": "0x00000069", + "lane1": "0x00000069", + "lane2": "0x00000069", + "lane3": "0x00000069", + "lane4": "0x00000069", + "lane5": "0x00000069", + "lane6": "0x00000069", + "lane7": "0x00000069" + }, + "post1":{ "lane0": "0x00000000", "lane1": "0x00000000", "lane2": "0x00000000", @@ -23409,7 +21605,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -23441,7 +21637,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -23503,7 +21699,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x00000044", + "lane1": "0x00000040", + "lane2": "0x0000003c", + "lane3": "0x00000040", + "lane4": "0x00000044", + "lane5": "0x00000040", + "lane6": "0x0000003c", + "lane7": "0x00000040" + }, + "post1":{ + "lane0": "0xfffffff0", + "lane1": "0xfffffff8", + "lane2": "0xfffffff4", + "lane3": "0xfffffff8", + "lane4": "0xfffffff0", + "lane5": "0xfffffff8", + "lane6": "0xfffffff4", + "lane7": "0xfffffff8" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -23535,7 +21763,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -23567,7 +21795,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -23599,7 +21827,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -23631,7 +21859,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -23662,10 +21890,42 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } + }, + "QSFP+-*":{ + "main":{ + "lane0": "0x00000046", + "lane1": "0x00000046", + "lane2": "0x00000046", + "lane3": "0x00000046", + "lane4": "0x00000046", + "lane5": "0x00000046", + "lane6": "0x00000046", + "lane7": "0x00000046" + }, + "post1":{ + "lane0": "0xfffffff4", + "lane1": "0xfffffff4", + "lane2": "0xfffffff4", + "lane3": "0xfffffff4", + "lane4": "0xfffffff4", + "lane5": "0xfffffff4", + "lane6": "0xfffffff4", + "lane7": "0xfffffff4" + }, + "pre1":{ + "lane0": "0xfffffffe", + "lane1": "0xfffffffe", + "lane2": "0xfffffffe", + "lane3": "0xfffffffe", + "lane4": "0xfffffffe", + "lane5": "0xfffffffe", + "lane6": "0xfffffffe", + "lane7": "0xfffffffe" + } } }, - "30":{ - "Amphenol-NDVYYF-0001":{ + "30":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -23727,7 +21987,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -23789,7 +22049,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -23851,7 +22111,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -23913,69 +22173,7 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x0000008c", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -24037,7 +22235,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM15XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -24099,69 +22297,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "QSFP28-40GBASE-CR4-1M":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -24193,7 +22329,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-2M":{ + "QSFP28-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -24225,7 +22361,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -24257,7 +22393,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -24319,7 +22455,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x00000040", + "lane1": "0x00000044", + "lane2": "0x00000040", + "lane3": "0x00000044", + "lane4": "0x00000040", + "lane5": "0x00000044", + "lane6": "0x00000040", + "lane7": "0x00000044" + }, + "post1":{ + "lane0": "0xfffffff4", + "lane1": "0xfffffff4", + "lane2": "0xfffffff4", + "lane3": "0xfffffff4", + "lane4": "0xfffffff4", + "lane5": "0xfffffff4", + "lane6": "0xfffffff4", + "lane7": "0xfffffff4" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -24351,7 +22519,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -24383,7 +22551,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -24415,7 +22583,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -24447,7 +22615,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -24478,72 +22646,42 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } - } - }, - "31":{ - "Amphenol-NDVYYF-0001":{ + }, + "QSFP+-*":{ "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x0000008c", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" + "lane0": "0x00000046", + "lane1": "0x00000046", + "lane2": "0x00000046", + "lane3": "0x00000046", + "lane4": "0x00000046", + "lane5": "0x00000046", + "lane6": "0x00000046", + "lane7": "0x00000046" }, "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" + "lane0": "0xfffffff4", + "lane1": "0xfffffff4", + "lane2": "0xfffffff4", + "lane3": "0xfffffff4", + "lane4": "0xfffffff4", + "lane5": "0xfffffff4", + "lane6": "0xfffffff4", + "lane7": "0xfffffff4" }, "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" + "lane0": "0xfffffffe", + "lane1": "0xfffffffe", + "lane2": "0xfffffffe", + "lane3": "0xfffffffe", + "lane4": "0xfffffffe", + "lane5": "0xfffffffe", + "lane6": "0xfffffffe", + "lane7": "0xfffffffe" } - }, - "Amphenol-NDVYYF-0003":{ + } + }, + "31":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -24605,7 +22743,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -24648,88 +22786,26 @@ }, "pre1":{ "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "Amphenol-NDVYYF-0002":{ - "main":{ - "lane0": "0x00000070", - "lane1": "0x0000008c", - "lane2": "0x00000080", - "lane3": "0x00000070", - "lane4": "0x00000070", - "lane5": "0x00000070", - "lane6": "0x00000070", - "lane7": "0x00000084" - }, - "post1":{ - "lane0": "0xffffffe8", - "lane1": "0xfffffffc", - "lane2": "0xfffffff0", - "lane3": "0xffffffe8", - "lane4": "0xffffffe8", - "lane5": "0xffffffe8", - "lane6": "0xffffffe8", - "lane7": "0xfffffff4" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe8", - "lane2": "0xffffffe8", + "lane1": "0xffffffe4", + "lane2": "0xffffffe4", "lane3": "0xffffffe4", "lane4": "0xffffffe4", "lane5": "0xffffffe4", "lane6": "0xffffffe4", - "lane7": "0xffffffe8" + "lane7": "0xffffffe4" }, "pre2":{ - "lane0": "0x00000004", - "lane1": "0x00000000", + "lane0": "0x00000002", + "lane1": "0x00000004", "lane2": "0x00000000", "lane3": "0x00000004", "lane4": "0x00000004", "lane5": "0x00000004", "lane6": "0x00000004", - "lane7": "0x00000000" + "lane7": "0x00000004" } }, - "Molex-2170601001":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -24791,16 +22867,26 @@ "lane7": "0x00000004" } }, - "ONET-1AT-5QAM10XX-10A":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" + "lane0": "0x00000070", + "lane1": "0x0000008c", + "lane2": "0x00000080", + "lane3": "0x00000070", + "lane4": "0x00000070", + "lane5": "0x00000070", + "lane6": "0x00000070", + "lane7": "0x00000084" + }, + "post1":{ + "lane0": "0xffffffe8", + "lane1": "0xfffffffc", + "lane2": "0xfffffff0", + "lane3": "0xffffffe8", + "lane4": "0xffffffe8", + "lane5": "0xffffffe8", + "lane6": "0xffffffe8", + "lane7": "0xfffffff4" }, "post2":{ "lane0": "0x00000000", @@ -24822,38 +22908,28 @@ "lane6": "0x00000000", "lane7": "0x00000000" }, + "pre1":{ + "lane0": "0xffffffe4", + "lane1": "0xffffffe8", + "lane2": "0xffffffe8", + "lane3": "0xffffffe4", + "lane4": "0xffffffe4", + "lane5": "0xffffffe4", + "lane6": "0xffffffe4", + "lane7": "0xffffffe8" + }, "pre2":{ - "lane0": "0x00000000", + "lane0": "0x00000004", "lane1": "0x00000000", "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", + "lane3": "0x00000004", + "lane4": "0x00000004", + "lane5": "0x00000004", + "lane6": "0x00000004", "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM15XX-10A":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -24915,7 +22991,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -24977,7 +23053,7 @@ "lane7": "0xfffffff0" } }, - "QSFP28-40GBASE-CR4-1M":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -25009,7 +23085,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-2M":{ + "QSFP28-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -25041,7 +23117,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -25073,7 +23149,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -25135,7 +23211,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x00000048", + "lane1": "0x00000046", + "lane2": "0x00000040", + "lane3": "0x00000044", + "lane4": "0x00000048", + "lane5": "0x00000046", + "lane6": "0x00000040", + "lane7": "0x00000044" + }, + "post1":{ + "lane0": "0xffffffec", + "lane1": "0xfffffff4", + "lane2": "0xfffffff0", + "lane3": "0xfffffff6", + "lane4": "0xffffffec", + "lane5": "0xfffffff4", + "lane6": "0xfffffff0", + "lane7": "0xfffffff6" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -25167,7 +23275,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -25199,7 +23307,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -25231,7 +23339,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -25263,7 +23371,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -25294,10 +23402,42 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } + }, + "QSFP+-*":{ + "main":{ + "lane0": "0x0000004a", + "lane1": "0x0000004a", + "lane2": "0x0000004a", + "lane3": "0x0000004a", + "lane4": "0x0000004a", + "lane5": "0x0000004a", + "lane6": "0x0000004a", + "lane7": "0x0000004a" + }, + "post1":{ + "lane0": "0xfffffff2", + "lane1": "0xfffffff2", + "lane2": "0xfffffff2", + "lane3": "0xfffffff2", + "lane4": "0xfffffff2", + "lane5": "0xfffffff2", + "lane6": "0xfffffff2", + "lane7": "0xfffffff2" + }, + "pre1":{ + "lane0": "0xfffffffe", + "lane1": "0xfffffffe", + "lane2": "0xfffffffe", + "lane3": "0xfffffffe", + "lane4": "0xfffffffe", + "lane5": "0xfffffffe", + "lane6": "0xfffffffe", + "lane7": "0xfffffffe" + } } }, - "32":{ - "Amphenol-NDVYYF-0001":{ + "32":{ + "QSFP-DD-passive_copper_media_interface-1.0M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -25359,7 +23499,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0003":{ + "QSFP-DD-passive_copper_media_interface-1.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -25421,7 +23561,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0004":{ + "QSFP-DD-passive_copper_media_interface-0.5M":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -25483,7 +23623,7 @@ "lane7": "0x00000004" } }, - "Amphenol-NDVYYF-0002":{ + "QSFP-DD-passive_copper_media_interface-2.0M":{ "main":{ "lane0": "0x00000070", "lane1": "0x0000008c", @@ -25545,131 +23685,7 @@ "lane7": "0x00000000" } }, - "Molex-2170601001":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x0000008c", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post1":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre1":{ - "lane0": "0xffffffe4", - "lane1": "0xffffffe4", - "lane2": "0xffffffe4", - "lane3": "0xffffffe4", - "lane4": "0xffffffe4", - "lane5": "0xffffffe4", - "lane6": "0xffffffe4", - "lane7": "0xffffffe4" - }, - "pre2":{ - "lane0": "0x00000002", - "lane1": "0x00000004", - "lane2": "0x00000000", - "lane3": "0x00000004", - "lane4": "0x00000004", - "lane5": "0x00000004", - "lane6": "0x00000004", - "lane7": "0x00000004" - } - }, - "ONET-1AT-5QAM10XX-10A":{ - "main":{ - "lane0": "0x00000088", - "lane1": "0x00000088", - "lane2": "0x00000088", - "lane3": "0x00000088", - "lane4": "0x00000088", - "lane5": "0x00000088", - "lane6": "0x00000088", - "lane7": "0x00000088" - }, - "post2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post3":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "pre2":{ - "lane0": "0x00000000", - "lane1": "0x00000000", - "lane2": "0x00000000", - "lane3": "0x00000000", - "lane4": "0x00000000", - "lane5": "0x00000000", - "lane6": "0x00000000", - "lane7": "0x00000000" - }, - "post1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - }, - "pre1":{ - "lane0": "0xfffffff0", - "lane1": "0xfffffff0", - "lane2": "0xfffffff0", - "lane3": "0xfffffff0", - "lane4": "0xfffffff0", - "lane5": "0xfffffff0", - "lane6": "0xfffffff0", - "lane7": "0xfffffff0" - } - }, - "ONET-1AT-5QAM15XX-10A":{ + "QSFP-DD-sm_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -25731,7 +23747,7 @@ "lane7": "0xfffffff0" } }, - "ONET-1AT-5QAM20XX-10A":{ + "QSFP-DD-active_cable_media_interface":{ "main":{ "lane0": "0x00000088", "lane1": "0x00000088", @@ -25793,7 +23809,7 @@ "lane7": "0xfffffff0" } }, - "QSFP28-40GBASE-CR4-1M":{ + "QSFP28-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -25825,7 +23841,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-2M":{ + "QSFP28-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -25857,7 +23873,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-3M":{ + "QSFP28-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -25889,7 +23905,7 @@ "lane7": "0xffffffec" } }, - "QSFP28-40GBASE-CR4-5M":{ + "QSFP28-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000069", "lane1": "0x00000069", @@ -25951,7 +23967,39 @@ "lane7": "0xffffffec" } }, - "QSFP+-40GBASE-CR4-1M":{ + "QSFP28-*":{ + "main":{ + "lane0": "0x00000040", + "lane1": "0x0000004e", + "lane2": "0x00000044", + "lane3": "0x00000046", + "lane4": "0x00000040", + "lane5": "0x0000004e", + "lane6": "0x00000044", + "lane7": "0x00000046" + }, + "post1":{ + "lane0": "0xfffffff0", + "lane1": "0xffffffec", + "lane2": "0xfffffff4", + "lane3": "0xfffffff0", + "lane4": "0xfffffff0", + "lane5": "0xffffffec", + "lane6": "0xfffffff4", + "lane7": "0xfffffff0" + }, + "pre1":{ + "lane0": "0xfffffffc", + "lane1": "0xfffffffc", + "lane2": "0xfffffffc", + "lane3": "0xfffffffc", + "lane4": "0xfffffffc", + "lane5": "0xfffffffc", + "lane6": "0xfffffffc", + "lane7": "0xfffffffc" + } + }, + "QSFP+-40GBASE-CR4-1.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -25983,7 +24031,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-2M":{ + "QSFP+-40GBASE-CR4-2.0M":{ "main":{ "lane0": "0x0000001e", "lane1": "0x0000001e", @@ -26015,7 +24063,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-3M":{ + "QSFP+-40GBASE-CR4-3.0M":{ "main":{ "lane0": "0x0000003c", "lane1": "0x0000003c", @@ -26047,7 +24095,7 @@ "lane7": "0x00000000" } }, - "QSFP+-40GBASE-CR4-5M":{ + "QSFP+-40GBASE-CR4-5.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -26079,7 +24127,7 @@ "lane7": "0xfffffffa" } }, - "QSFP+-40GBASE-CR4-7M":{ + "QSFP+-40GBASE-CR4-7.0M":{ "main":{ "lane0": "0x00000057", "lane1": "0x00000057", @@ -26110,9 +24158,39 @@ "lane6": "0xfffffffa", "lane7": "0xfffffffa" } + }, + "QSFP-+*":{ + "main":{ + "lane0": "0x0000004a", + "lane1": "0x0000004a", + "lane2": "0x0000004a", + "lane3": "0x0000004a", + "lane4": "0x0000004a", + "lane5": "0x0000004a", + "lane6": "0x0000004a", + "lane7": "0x0000004a" + }, + "post1":{ + "lane0": "0xfffffff2", + "lane1": "0xfffffff2", + "lane2": "0xfffffff2", + "lane3": "0xfffffff2", + "lane4": "0xfffffff2", + "lane5": "0xfffffff2", + "lane6": "0xfffffff2", + "lane7": "0xfffffff2" + }, + "pre1":{ + "lane0": "0xfffffffe", + "lane1": "0xfffffffe", + "lane2": "0xfffffffe", + "lane3": "0xfffffffe", + "lane4": "0xfffffffe", + "lane5": "0xfffffffe", + "lane6": "0xfffffffe", + "lane7": "0xfffffffe" + } } } } } - - From a2d33a2a37aa4d66df7cd6af510b202e6982480c Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Wed, 5 May 2021 07:33:31 -0700 Subject: [PATCH 021/136] [ci]: enable sonic-slave scheduled build on 202012 Signed-off-by: Guohan Lu --- .azure-pipelines/docker-sonic-slave.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/docker-sonic-slave.yml b/.azure-pipelines/docker-sonic-slave.yml index 1da5f4c911ee..071cc73e8790 100644 --- a/.azure-pipelines/docker-sonic-slave.yml +++ b/.azure-pipelines/docker-sonic-slave.yml @@ -9,6 +9,7 @@ schedules: branches: include: - master + - 202012 always: true trigger: none @@ -20,12 +21,12 @@ pr: include: - sonic-slave-jessie - sonic-slave-stretch - - sonic-slave-buster + - sonic-slave-buster parameters: - name: 'arches' type: object - default: + default: - amd64 - armhf - arm64 From 659d078fd3507c4e67ed893eb458a278db2f3171 Mon Sep 17 00:00:00 2001 From: Aravind Mani <53524901+aravindmani-1@users.noreply.github.com> Date: Wed, 5 May 2021 10:03:11 -0700 Subject: [PATCH 022/136] DellEMC: Z9332f SFP enhancements (#7457) #### Why I did it 400G media EEPROM and DOM information are not populated properly in DellEMC Z9332f platform. #### How I did it Handled QSFP_DD, QSFP28/QSFP+, SFP+ accordingly based on media type detected. --- .../z9332f/sonic_platform/chassis.py | 2 +- .../z9332f/sonic_platform/sfp.py | 591 +++++++++++++----- 2 files changed, 452 insertions(+), 141 deletions(-) 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 e337922a3424..d32e3c8c1c5a 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 @@ -121,7 +121,7 @@ def __init__(self): eeprom_base = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" for index in range(self.PORT_START, self.PORTS_IN_BLOCK): eeprom_path = eeprom_base.format(self._port_to_i2c_mapping[index]) - port_type = 'SFP' if index in _sfp_port else 'QSFP' + port_type = 'SFP' if index in _sfp_port else 'QSFP_DD' sfp_node = Sfp(index, port_type, eeprom_path) self._sfp_list.append(sfp_node) 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 a6aa228ac333..7934b08626bf 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 @@ -21,23 +21,45 @@ 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") -# Enabled when ext_media is available -#ext_media_module = None -#try: -# import ext_media_api as ext_media_module -#except : -# ext_media_module = None -# pass - 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_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 = 26 +QSFP_DD_TXBIAS_WIDTH = 16 +QSFP_DD_TXPOWER_OFFSET = 42 +QSFP_DD_TXPOWER_WIDTH = 16 +QSFP_DD_RXPOWER_WIDTH = 58 +QSFP_DD_RXPOWER_OFFSET = 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 + QSFP_INFO_OFFSET = 128 QSFP_DOM_OFFSET = 0 QSFP_DOM_OFFSET1 = 384 @@ -83,9 +105,13 @@ 'power_lpmode', 'tx_disable', 'tx_disable_channel', 'temperature', 'voltage', 'rx1power', 'rx2power', 'rx3power', 'rx4power', - 'tx1bias', 'tx2bias', 'tx3bias', - 'tx4bias', 'tx1power', 'tx2power', - 'tx3power', 'tx4power'] + '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', @@ -97,6 +123,22 @@ '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'], @@ -108,9 +150,8 @@ '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': + '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'], @@ -172,7 +213,7 @@ '11' # QSFP28 or later ] QSFP_DD_TYPE_LIST = [ - '18' #QSFP-DD Type + '18' #QSFP_DD Type ] OSFP_TYPE_LIST=[ '19' # OSFP 8X Type @@ -226,25 +267,50 @@ def __init__(self, index, sfp_type, eeprom_path): SfpBase.__init__(self) self.index = index self.eeprom_path = eeprom_path - #sfp_type is the native port type and media_type is the transceiver type - #media_type will be detected in get_transceiver_info - self.sfp_type = sfp_type - self.media_type = self.sfp_type + #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() def get_eeprom_sysfs_path(self): 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.dom_rx_power_supported = True + self.dom_tx_power_supported = True + self.dom_tx_bias_supported = True + else: + self.qsfp_dd_app2_list = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + self.dom_tx_bias_supported = False + else: + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + self.dom_tx_bias_supported = False + 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 pci_mem_read(self, mm, offset): @@ -312,24 +378,46 @@ def _get_eeprom_data(self, eeprom_key): eeprom_data = None page_offset = None - if self.media_type.startswith('QSFP'): + 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): + 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): + 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): + if self.qsfpDomInfo is None: return None eeprom_data = getattr( self.qsfpDomInfo, sff8436_parser[eeprom_key][FUNC_NAME])( @@ -341,17 +429,17 @@ def _get_eeprom_data(self, eeprom_key): (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): + 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): + 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): + if self.sfpDomInfo is None: return None eeprom_data = getattr( self.sfpDomInfo, sff8472_parser[eeprom_key][FUNC_NAME])( @@ -366,12 +454,17 @@ def get_transceiver_info(self): transceiver_info_dict = {} compliance_code_dict = {} transceiver_info_dict = dict.fromkeys(info_dict_keys, 'N/A') - self.media_type = self.set_media_type() - if not self.reinit_sfp_driver(): + 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 - try: + 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'] @@ -379,9 +472,8 @@ def get_transceiver_info(self): 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.media_type.startswith('QSFP'): - bit_rate = str( - iface_data['data']['Nominal Bit Rate(100Mbs)']['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'] @@ -400,7 +492,7 @@ def get_transceiver_info(self): cable_type = key cable_length = str(iface_data['data'][key]['value']) - transceiver_info_dict['type_abbrv_name']=type_abbrv_name + transceiver_info_dict['type_abbrv_name'] = type_abbrv_name transceiver_info_dict['type'] = identifier transceiver_info_dict['connector'] = connector transceiver_info_dict['encoding'] = encoding @@ -410,58 +502,135 @@ def get_transceiver_info(self): 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 + 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 - 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 + if vendor_name_data is not None: + vendor_name = vendor_name_data['data']['Vendor Name']['value'] + transceiver_info_dict['manufacturer'] = vendor_name - # 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 + 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 - 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 + if vendor_pn_data is not None: + vendor_pn = vendor_pn_data['data']['Vendor PN']['value'] + transceiver_info_dict['model'] = vendor_pn - # 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 + if vendor_rev_data is not None: + vendor_rev = vendor_rev_data['data']['Vendor Rev']['value'] + transceiver_info_dict['hardware_rev'] = vendor_rev - # 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 + 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 - # Attempt ext_media read -# if ext_media_module is not None: -# ext_media_dict = ext_media_module.get_ext_media_info(self) -# for key in ext_media_dict: -# value = ext_media_dict[key] -# if value in [None, 'None', 'none','n/a', '']: -# value = 'N/A' -# transceiver_info_dict[key] = str(value) + 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 @@ -474,9 +643,30 @@ def get_transceiver_threshold_info(self): threshold_dict_keys, 'N/A') try: - # Module Threshold - module_threshold_data = self._get_eeprom_data('ModuleThreshold') - if self.media_type.startswith('QSFP'): + if self.sfp_type == 'QSFP_DD': + module_threshold_data = self._get_eeprom_data('ModuleThreshold') + 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': + module_threshold_data = self._get_eeprom_data('ModuleThreshold') 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'] @@ -509,7 +699,7 @@ def get_transceiver_threshold_info(self): except (ValueError, TypeError) : pass try: - if self.media_type.startswith('QSFP'): + 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'] @@ -565,23 +755,58 @@ def get_transceiver_bulk_status(self): # 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 self.sfp_type == 'QSFP_DD': + 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] + 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] - 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] + else: + 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 self.sfp_type == 'QSFP_DD': + 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] + 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] - 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] + else: + 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 self.sfp_type == 'QSFP_DD': + 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['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] + else: + 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 @@ -612,7 +837,7 @@ 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)} + mask = {'QSFP_DD' : (1 << 4), 'SFP' : (1 << 0)} # Port offset starts with 0x4004 port_offset = 16388 + ((self.index-1) * 16) @@ -620,7 +845,7 @@ def get_presence(self): status = self.pci_get_value(self.BASE_RES_PATH, port_offset) reg_value = int(status) # ModPrsL is active low - if reg_value & mask[self.sfp_type] == 0: + if reg_value & mask[self.port_type] == 0: return True except ValueError: pass @@ -656,7 +881,7 @@ def get_reset_status(self): """ reset_status = False try: - if (self.sfp_type == 'QSFP'): + if self.port_type == 'QSFP_DD': # Port offset starts with 0x4000 port_offset = 16384 + ((self.index-1) * 16) @@ -676,10 +901,20 @@ def get_rx_los(self): """ rx_los_list = [] try: - if self.media_type.startswith('QSFP'): + 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 + # 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: @@ -696,7 +931,9 @@ def get_tx_fault(self): """ tx_fault_list = [] try: - if self.media_type.startswith('QSFP'): + if self.sfp_type == 'QSFP_DD': + tx_fault_list = 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') @@ -714,7 +951,9 @@ def get_tx_disable(self): """ tx_disable_list = [] try: - if self.media_type.startswith('QSFP'): + 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') @@ -734,7 +973,9 @@ def get_tx_disable_channel(self): """ tx_disable_channel = 0 try: - if self.media_type.startswith('QSFP'): + 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 @@ -748,8 +989,8 @@ def get_lpmode(self): Retrieves the lpmode(low power mode) of this SFP """ lpmode_state = False - try: - if self.media_type.startswith('QSFP'): + try: + if self.sfp_type.startswith('QSFP'): # Port offset starts with 0x4000 port_offset = 16384 + ((self.index-1) * 16) @@ -770,10 +1011,10 @@ def get_power_override(self): power_override_state = False try: - if self.media_type.startswith('QSFP'): + 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 == 'On') + power_override_state = (power_override is 'On') except (TypeError, ValueError): pass return power_override_state @@ -782,8 +1023,18 @@ def get_temperature(self): Retrieves the temperature of this SFP """ temperature = None - try : - temperature_data = self._get_eeprom_data('Temperature') + 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) + + elif self.sfp_type == 'QSFP': + temperature_data = self._get_eeprom_data('Temperature') + temperature = self._strip_unit_from_str(temperature_data['data']['Temperature']['value']) except (TypeError, ValueError): return None @@ -795,8 +1046,19 @@ def get_voltage(self): """ voltage = None try: - voltage_data = self._get_eeprom_data('Voltage') + 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) + + elif self.sfp_type == 'QSFP': + voltage_data = self._get_eeprom_data('Voltage') + voltage = self._strip_unit_from_str(voltage_data['data']['Vcc']['value']) + except (TypeError, ValueError): return None return voltage @@ -807,14 +1069,29 @@ def get_tx_bias(self): """ tx_bias_list = [] try: - tx_bias_data = self._get_eeprom_data('ChannelMonitor') - if self.media_type.startswith('QSFP'): - for tx_bias_id in ('TX1Bias', 'TX2Bias', 'TX3Bias', 'TX4Bias') : + offset = 128 + if self.sfp_type == 'QSFP_DD': + if self.qsfp_dd_DomInfo is None: + return None + if not self.dom_tx_bias_supported: + return None + 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: - tx1_bias = tx_bias_data['data']['TXBias']['value'] - tx_bias_list.append(self._strip_unit_from_str(tx1_bias)) + 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 @@ -824,15 +1101,29 @@ def get_rx_power(self): Retrieves the received optical power for this SFP """ rx_power_list = [] + offset = 128 try: - rx_power_data = self._get_eeprom_data('ChannelMonitor') - if self.media_type.startswith('QSFP'): - for rx_power_id in ('RX1Power', 'RX2Power', 'RX3Power', 'RX4Power'): + if self.sfp_type == 'QSFP_DD': + if self.qsfp_dd_DomInfo is None: + return None + if not self.dom_rx_power_supported: + return None + 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(self._strip_unit_from_str(rx_power)) + 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: - rx1_pw = rx_power_data['data']['RXPower']['value'] - rx_power_list.append(self._strip_unit_from_str(rx1_pw)) + 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 @@ -842,8 +1133,25 @@ def get_tx_power(self): Retrieves the TX power of this SFP """ tx_power_list = [] + offset = 128 try: - if self.media_type.startswith('QSFP'): + if self.sfp_type == 'QSFP_DD': + if self.qsfp_dd_DomInfo is None: + return None + + if not self.dom_tx_power_supported: + return None + + 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 @@ -859,12 +1167,12 @@ def get_tx_power(self): 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(self._strip_unit_from_str(tx_pw)) + 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') - tx1_pw = channel_monitor_data['data']['TXPower']['value'] - tx_power_list.append(self._strip_unit_from_str(tx1_pw)) + 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 @@ -874,7 +1182,7 @@ def reset(self): Reset the SFP and returns all user settings to their default state """ try: - if (self.sfp_type == 'QSFP'): + if self.port_type == 'QSFP_DD': # Port offset starts with 0x4000 port_offset = 16384 + ((self.index-1) * 16) @@ -906,7 +1214,7 @@ def set_lpmode(self, lpmode): Sets the lpmode(low power mode) of this SFP """ try: - if (self.sfp_type == 'QSFP'): + if self.port_type == 'QSFP_DD': # Port offset starts with 0x4000 port_offset = 16384 + ((self.index-1) * 16) @@ -933,8 +1241,8 @@ def get_intl_state(self): Sets the intL (interrupt; active low) pin of this SFP """ intl_state = True - try: - if (self.sfp_type == 'QSFP'): + try: + if self.port_type == 'QSFP_DD': # Port offset starts with 0x4004 port_offset = 16388 + ((self.index-1) * 16) @@ -977,18 +1285,18 @@ def get_port_form_factor(self): """ Retrieves the native port type """ - return self.sfp_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.sfp_type=='QSFP' else 2.5) + return 12.0 if self.port_type == 'QSFP_DD' else 2.5 def set_media_type(self): """ @@ -998,18 +1306,18 @@ def set_media_type(self): eeprom_raw = self._read_eeprom_bytes(self.eeprom_path, MEDIA_TYPE_OFFSET, MEDIA_TYPE_WIDTH) if eeprom_raw is not None: if eeprom_raw[0] in SFP_TYPE_LIST: - self.media_type = 'SFP' + self.sfp_type = 'SFP' elif eeprom_raw[0] in QSFP_TYPE_LIST: - self.media_type = 'QSFP' + self.sfp_type = 'QSFP' elif eeprom_raw[0] in QSFP_DD_TYPE_LIST: - self.media_type = 'QSFP-DD' + self.sfp_type = 'QSFP_DD' else: #Set native port type if EEPROM type is not recognized/readable - self.media_type = self.sfp_type + self.sfp_type = self.port_type else: - self.media_type = self.sfp_type + self.sfp_type = self.port_type - return self.media_type + return self.sfp_type def reinit_sfp_driver(self): """ @@ -1031,18 +1339,21 @@ def reinit_sfp_driver(self): driver_name = driver_name.lstrip(" ") #Avoid re-initialization of the QSFP/SFP optic on QSFP/SFP port. - if (self.media_type == 'SFP' and (driver_name == 'optoe1' or driver_name == 'optoe3')): + 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.media_type == 'QSFP' and (driver_name == 'optoe2' or driver_name == 'optoe3')): + 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.media_type == 'QSFP-DD' and (driver_name == 'optoe1' or driver_name == 'optoe2')): + 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) From 15be15392d91dd3adcf490727f46b87a7e48c7e0 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 5 May 2021 15:42:33 -0700 Subject: [PATCH 023/136] [ci]: build swi on broadcom platform for pr (#7522) Signed-off-by: Guohan Lu --- azure-pipelines.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c842b4a44480..29fcb8b2ed44 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -44,6 +44,8 @@ stages: jobGroups: - name: vs - name: broadcom + variables: + swi_image: yes - name: mellanox - stage: Test From 557483d0b7d520ec6453465331351a0699ededce Mon Sep 17 00:00:00 2001 From: shlomibitton <60430976+shlomibitton@users.noreply.github.com> Date: Thu, 6 May 2021 17:40:08 +0300 Subject: [PATCH 024/136] Revert "[submodule]: Update sonic-swss (#7478)" (#7524) This reverts commit 963e7f4c2c1c7ccc8ee2d1ab67db748697f73ca3. --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index ee7a73508d84..d9f28b64255d 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit ee7a73508d84eb36468d842ebc12f1928f984533 +Subproject commit d9f28b64255db54310d3398119f13dfb3203f311 From a795bc0b8ed33e0fc497aec5a8cfb69842b56142 Mon Sep 17 00:00:00 2001 From: Junchao-Mellanox <57339448+Junchao-Mellanox@users.noreply.github.com> Date: Fri, 7 May 2021 01:13:26 +0800 Subject: [PATCH 025/136] [Mellanox] Support new sensor conf file for MSN4700 A1/A0 (#7535) #### Why I did it MSN4700 A1/A0 used different sensor chip but keep the existing platform name *x86_64-mlnx_msn4700-r0*, this is a workaround to replace the sensor conf on MSN4700 A1/A0 #### How I did it Use a shell script to get the sensor conf path and copy that files to /etc/sensors.d/sensors.conf --- .../get_sensors_conf_path | 21 +++ .../x86_64-mlnx_msn4700-r0/sensors.conf.a1 | 142 ++++++++++++++++++ dockers/docker-platform-monitor/Dockerfile.j2 | 8 +- .../{docker_init.sh => docker_init.j2} | 9 +- 4 files changed, 177 insertions(+), 3 deletions(-) create mode 100755 device/mellanox/x86_64-mlnx_msn4700-r0/get_sensors_conf_path create mode 100644 device/mellanox/x86_64-mlnx_msn4700-r0/sensors.conf.a1 rename dockers/docker-platform-monitor/{docker_init.sh => docker_init.j2} (92%) diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/get_sensors_conf_path b/device/mellanox/x86_64-mlnx_msn4700-r0/get_sensors_conf_path new file mode 100755 index 000000000000..c347d7435416 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/get_sensors_conf_path @@ -0,0 +1,21 @@ +#!/bin/bash + +HW_VERSION="/var/run/hw-management/system/config1" +SENSORS_CONF_FILE="/usr/share/sonic/platform/sensors.conf" +SENSORS_CONF_FILE_A1="/usr/share/sonic/platform/sensors.conf.a1" + +function get_sensor_conf_path() { + local _HW_VERSION="0" + if [[ -e $HW_VERSION ]]; then + _HW_VERSION=$(cat $HW_VERSION 2>&1) + if [[ "$_HW_VERSION" == "1" ]]; then + if [[ -e $SENSORS_CONF_FILE_A1 ]]; then + echo $SENSORS_CONF_FILE_A1 + return + fi + fi + fi + echo $SENSORS_CONF_FILE +} + +get_sensor_conf_path diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/sensors.conf.a1 b/device/mellanox/x86_64-mlnx_msn4700-r0/sensors.conf.a1 new file mode 100644 index 000000000000..9511fac1278e --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/sensors.conf.a1 @@ -0,0 +1,142 @@ +################################################################################ +# Copyright (C) 20xx-2021 Mellanox Technologies, Ltd. ALL RIGHTS RESERVED. +# +# Platform specific sensors config for SN4700 A0/A1 +################################################################################ + +# 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-8 PSU 12V Rail (in1)" + label in2 "PMIC-8 PSU 12V Rail (in2)" + label in3 "PMIC-8 COMEX 1.8V Rail (out)" + label in4 "PMIC-8 COMEX 1.05V Rail (out)" + label temp1 "PMIC-8 Temp 1" + label temp2 "PMIC-8 Temp 2" + label power1 "PMIC-8 COMEX 1.8V Rail Pwr (out)" + label power2 "PMIC-8 COMEX 1.05V Rail Pwr (out)" + label curr1 "PMIC-8 COMEX 1.8V Rail Curr (out)" + label curr2 "PMIC-8 COMEX 1.05V Rail Curr (out)" + chip "tps53679-i2c-*-61" + label in1 "PMIC-9 PSU 12V Rail (in1)" + label in2 "PMIC-9 PSU 12V Rail (in2)" + label in3 "PMIC-9 COMEX 1.2V Rail (out)" + ignore in4 + label temp1 "PMIC-9 Temp 1" + label temp2 "PMIC-9 Temp 2" + label power1 "PMIC-9 COMEX 1.2V Rail Pwr (out)" + ignore power2 + label curr1 "PMIC-9 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" + 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" + 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 Tach 1" + label fan2 "Chassis Fan Drawer-1 Tach 2" + label fan3 "Chassis Fan Drawer-2 Tach 1" + label fan4 "Chassis Fan Drawer-2 Tach 2" + label fan5 "Chassis Fan Drawer-3 Tach 1" + label fan6 "Chassis Fan Drawer-3 Tach 2" + label fan7 "Chassis Fan Drawer-4 Tach 1" + label fan8 "Chassis Fan Drawer-4 Tach 2" + label fan9 "Chassis Fan Drawer-5 Tach 1" + label fan10 "Chassis Fan Drawer-5 Tach 2" + label fan11 "Chassis Fan Drawer-6 Tach 1" + label fan12 "Chassis Fan Drawer-6 Tach 2" + +# Miscellaneous +chip "*-virtual-*" + ignore temp1 diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 index e86f4ad0019b..7e8d75680fa8 100755 --- a/dockers/docker-platform-monitor/Dockerfile.j2 +++ b/dockers/docker-platform-monitor/Dockerfile.j2 @@ -84,10 +84,14 @@ RUN apt-get purge -y \ /python-wheels \ ~/.cache -COPY ["docker_init.sh", "lm-sensors.sh", "/usr/bin/"] -COPY ["docker-pmon.supervisord.conf.j2", "/usr/share/sonic/templates/"] +COPY ["lm-sensors.sh", "/usr/bin/"] +COPY ["docker-pmon.supervisord.conf.j2", "docker_init.j2", "/usr/share/sonic/templates/"] COPY ["ssd_tools/*", "/usr/bin/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] +RUN sonic-cfggen -a "{\"CONFIGURED_PLATFORM\":\"{{CONFIGURED_PLATFORM}}\"}" -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-platform-monitor/docker_init.sh b/dockers/docker-platform-monitor/docker_init.j2 similarity index 92% rename from dockers/docker-platform-monitor/docker_init.sh rename to dockers/docker-platform-monitor/docker_init.j2 index 6fc7ffeb5114..1d22e19b239b 100755 --- a/dockers/docker-platform-monitor/docker_init.sh +++ b/dockers/docker-platform-monitor/docker_init.j2 @@ -78,10 +78,17 @@ else SONIC_PLATFORM_API_PYTHON_VERSION=3 fi +{% if CONFIGURED_PLATFORM == "mellanox" %} +SENSORS_CONF_PATH_GETTER="/usr/share/sonic/platform/get_sensors_conf_path" +if [ -e $SENSORS_CONF_PATH_GETTER ]; then + SENSORS_CONF_FILE=$($SENSORS_CONF_PATH_GETTER 2>&1) +fi +{% endif %} + if [ -e $SENSORS_CONF_FILE ]; then HAVE_SENSORS_CONF=1 mkdir -p /etc/sensors.d - /bin/cp -f $SENSORS_CONF_FILE /etc/sensors.d/ + /bin/cp -f $SENSORS_CONF_FILE /etc/sensors.d/sensors.conf fi if [ -e $FANCONTROL_CONF_FILE ]; then From 9f0dce0313df78b75bccf178eea732742b9a5054 Mon Sep 17 00:00:00 2001 From: Stephen Sun <5379172+stephenxs@users.noreply.github.com> Date: Fri, 7 May 2021 01:14:48 +0800 Subject: [PATCH 026/136] [Mellanox] Optimize SFP modules initialization (#7537) Originally, SFP modules were always accessed from platform daemons, and arbitrary SFP modules can be accessed in the daemon. So all SFP modules were initialized in one shot once one of the following chassis APIs called - get_all_sfps - get_sfp_numbers - get_sfp Recently, we noticed that SFP modules can also be accessed from CLI, eg. the latest refactor of `sfputil`. In this case, only one SFP module is accessed in the chassis object's life cycle. To initialize all SFP modules in one shot is waste of time and causes the CLI to take much more time to finish. So we would like to optimize the initialization flow by introducing a two-phase initialization approach: - Partial initialization, which means the `chassis._sfp_list` has been initialized with proper length and all elements being `None` - Full initialization, which means all elements in `chassis._sfp_list` are created If the relevant function is called, - `get_sfp`, only partial initialization will be done, and then the specific SFP module is initialized. - `get_all_sfps` or `get_num_sfps`, full initialization will be done, which means all SFP modules are initialized. Signed-off-by: Stephen Sun --- .../sonic_platform/chassis.py | 83 ++++++++++++++---- .../mlnx-platform-api/tests/test_sfp.py | 84 +++++++++++++++++++ 2 files changed, 150 insertions(+), 17 deletions(-) create mode 100644 platform/mellanox/mlnx-platform-api/tests/test_sfp.py diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py b/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py index 2ae93e14d4c0..b18d780faba9 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py @@ -66,10 +66,38 @@ def __init__(self): # Initialize Platform name self.platform_name = device_info.get_platform() - + # move the initialization of each components to their dedicated initializer # which will be called from platform - self.sfp_module_initialized = False + # + # Multiple scenarios need to be taken into consideration regarding the SFP modules initialization. + # - Platform daemons + # - Can access multiple or all SFP modules + # - sfputil + # - Sometimes can access only one SFP module + # - Call get_sfp to get one SFP module object + # + # We should initialize all SFP modules only if it is necessary because initializing SFP module is time-consuming. + # This means, + # - If get_sfp is called, + # - If the _sfp_list isn't initialized, initialize it first. + # - Only the SFP module being required should be initialized. + # - If get_all_sfps is called, + # - If the _sfp_list isn't initialized, initialize it first. + # - All SFP modules need to be initialized. + # But the SFP modules that have already been initialized should not be initialized for the second time. + # This can caused by get_sfp being called before. + # + # Due to the complexity of SFP modules initialization, we have to introduce two initialized flags for SFP modules + # - sfp_module_partial_initialized: + # - False: The _sfp_list is [] (SFP stuff has never been accessed) + # - True: The _sfp_list is a list whose length is number of SFP modules supported by the platform + # - sfp_module_full_initialized: + # - 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.reboot_cause_initialized = False self.sdk_handle = None @@ -115,7 +143,17 @@ def initialize_fan(self): self._fan_list.append(fan) - def initialize_sfp(self): + 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 @@ -127,15 +165,22 @@ def initialize_sfp(self): self.PORT_END = port_position_tuple[2] self.PORTS_IN_BLOCK = port_position_tuple[3] - for index in range(self.PORT_START, self.PORT_END + 1): - if index in range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1): - sfp_module = SFP(index, 'QSFP', self.get_sdk_handle, self.platform_name) - else: - sfp_module = SFP(index, 'SFP', self.get_sdk_handle, self.platform_name) - - self._sfp_list.append(sfp_module) + 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)) + 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_initialized = True + self.sfp_module_full_initialized = True def get_sdk_handle(self): @@ -206,7 +251,7 @@ def get_num_sfps(self): Returns: An integer, the number of sfps available on this chassis """ - if not self.sfp_module_initialized: + if not self.sfp_module_full_initialized: self.initialize_sfp() return len(self._sfp_list) @@ -219,7 +264,7 @@ def get_all_sfps(self): A list of objects derived from SfpBase representing all sfps available on this chassis """ - if not self.sfp_module_initialized: + if not self.sfp_module_full_initialized: self.initialize_sfp() return self._sfp_list @@ -237,13 +282,17 @@ def get_sfp(self, index): Returns: An object dervied from SfpBase representing the specified sfp """ - if not self.sfp_module_initialized: - self.initialize_sfp() - sfp = None index -= 1 + 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)) @@ -488,7 +537,7 @@ def reinit_sfps(self, port_dict): :return: """ # SFP not initialize yet, do nothing - if not self.sfp_module_initialized: + if not self.sfp_module_full_initialized: return from . import sfp diff --git a/platform/mellanox/mlnx-platform-api/tests/test_sfp.py b/platform/mellanox/mlnx-platform-api/tests/test_sfp.py new file mode 100644 index 000000000000..0c24eb83354e --- /dev/null +++ b/platform/mellanox/mlnx-platform-api/tests/test_sfp.py @@ -0,0 +1,84 @@ +import os +import sys +import pytest +from mock import MagicMock +from .mock_platform import MockFan + +test_path = os.path.dirname(os.path.abspath(__file__)) +modules_path = os.path.dirname(test_path) +sys.path.insert(0, modules_path) + +from sonic_py_common import device_info +from sonic_platform.sfp import SFP +from sonic_platform.chassis import Chassis + + +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 + +device_info.get_platform = mock_get_platform +SFP._read_eeprom_specific_bytes = mock_read_eeprom_specific_bytes +Chassis.get_sdk_handle = mock_get_sdk_handle + + +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() + + # 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 + + # Fetch another SFP module + sfp2 = chassis.get_sfp(2) + # Verify the previous SFP module isn't changed + assert sfp1 == chassis.get_sfp(1) + + # 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 + + +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() + + # 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 + + # Verify when get_sfp is called, the SFP modules won't be initialized again + sfp1 = allsfp[0] + assert sfp1 == chassis.get_sfp(1) From 7124dbe56beeeaf25719c7d90f1bdca49a53b76d Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 6 May 2021 10:57:03 -0700 Subject: [PATCH 027/136] [sonic-yang-models]: fix unit test failure (#7436) https://github.com/mbj4668/pyang/blob/master/pyang/repository.py#L93 throws an exception with pip 21.1 add ietf yang model explicitly to the build process fix the test failure. tests/test_sonic_yang_models.py .F [ 66%] tests/yang_model_tests/test_yang_model.py . [100%] Failed: pyang -f tree ./yang-models/*.yang > ./yang-models/sonic_yang_tree ----------------------------- Captured stderr call ----------------------------- ./yang-models/sonic-acl.yang:8: error: module "ietf-inet-types" not found in search path ./yang-models/sonic-device_metadata.yang:8: error: module "ietf-yang-types" not found in search path Signed-off-by: Guohan Lu --- src/sonic-yang-models/tests/test_sonic_yang_models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sonic-yang-models/tests/test_sonic_yang_models.py b/src/sonic-yang-models/tests/test_sonic_yang_models.py index e5b801a94cb5..6db0c1b5678a 100644 --- a/src/sonic-yang-models/tests/test_sonic_yang_models.py +++ b/src/sonic-yang-models/tests/test_sonic_yang_models.py @@ -24,9 +24,12 @@ def test_content(response): def test_generate_yang_tree(): # Generate YANG Tree, see no error in it. - pyang_tree_cmd = "pyang -f tree ./yang-models/*.yang > ./yang-models/sonic_yang_tree" + pyang_tree_cmd = "pyang -Vf tree -p /usr/local/share/yang/modules/ietf ./yang-models/*.yang > ./yang-models/sonic_yang_tree" if (system(pyang_tree_cmd)): print("Failed: {}".format(pyang_tree_cmd)) + system("pyang --version") + system("env") + system("ls -l /usr/local/share/yang/modules/ietf/") exit(1) else: print("Passed: {}".format(pyang_tree_cmd)) From e7c26fb0c97aefcbe5a799b4bd2ae7152c85d1f3 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Thu, 6 May 2021 10:59:22 -0700 Subject: [PATCH 028/136] [Arista] Update platform configurations and library (#7527) Platform library changes - Fix the use of /proc/modules during testing, fixes #7463 - Add `libsfp-eeprom.so` build to read/write xcvr eeproms in C - Add some more reboot-cause information - Write down temperature hw thresholds to the sensors - Report software thresholds through platform api - Writ `port_name sysfs` file of optoe` - Tests enhancements - Fix dependency issues for chassis provisioning Platform configuration changes - Add `pcie.yaml` configuration for a few platforms - Mount `libsfp-eeprom.so` inside `pmon` - Fix `Arista-7050SX3-48C8` and `Arista-7050SX3-48YC8' platform and hwsku - Miscellaneous fixes Co-authored-by: Boyang Yu Co-authored-by: Zhi Yuan Carl Zhao --- .../arista/x86_64-arista_7050_qx32/pcie.yaml | 148 +++++ device/arista/x86_64-arista_7050sx3_48c8 | 1 - .../Arista-7050SX3-48C8/buffers.json.j2 | 2 + .../buffers_defaults_t0.j2 | 49 ++ .../Arista-7050SX3-48C8/pg_profile_lookup.ini | 17 + .../Arista-7050SX3-48C8/port_config.ini | 57 ++ .../Arista-7050SX3-48C8/qos.json.j2 | 21 + .../Arista-7050SX3-48C8/sai.profile | 2 + ...td3-a7050sx3_48c8-48x10G+8x100G.config.bcm | 541 ++++++++++++++++++ .../Arista-7050SX3-48YC8 | 1 + .../x86_64-arista_7050sx3_48c8/default_sku | 1 + .../x86_64-arista_7050sx3_48c8/pcie.yaml | 163 ++++++ .../platform_reboot | 1 + .../plugins/eeprom.py | 1 + .../plugins/led_control.py | 1 + .../plugins/psuutil.py | 1 + .../plugins/sfputil.py | 1 + .../pmon_daemon_control.json | 1 + .../x86_64-arista_7050sx3_48c8/sensors.conf | 1 + .../system_health_monitoring_config.json | 1 + .../thermal_policy.json | 1 + .../buffers_defaults_t0.j2 | 9 +- .../Arista-7050SX3-48YC8/port_config.ini | 112 ++-- ...d3-a7050sx3_48yc8-48x25G+8x100G.config.bcm | 137 ++++- .../x86_64-arista_7050sx3_48yc8/pcie.yaml | 163 ++++++ .../x86_64-arista_7050sx3_48yc8/sensors.conf | 16 +- .../arista/x86_64-arista_7060dx4_32/pcie.yaml | 433 ++++++++++++++ .../arista/x86_64-arista_7060px4_32/pcie.yaml | 433 ++++++++++++++ .../arista/x86_64-arista_7170_64c/pcie.yaml | 421 ++++++++++++++ .../Arista-7280CR3-C32P4/sai.profile | 0 .../x86_64-arista_7280cr3_32p4/sensors.conf | 16 +- .../barefoot/sonic-platform-modules-arista | 2 +- .../broadcom/sonic-platform-modules-arista | 2 +- rules/docker-platform-monitor.mk | 1 + 34 files changed, 2668 insertions(+), 89 deletions(-) create mode 100644 device/arista/x86_64-arista_7050_qx32/pcie.yaml delete mode 120000 device/arista/x86_64-arista_7050sx3_48c8 create mode 100644 device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48C8/buffers.json.j2 create mode 100644 device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48C8/buffers_defaults_t0.j2 create mode 100644 device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48C8/pg_profile_lookup.ini create mode 100644 device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48C8/port_config.ini create mode 100644 device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48C8/qos.json.j2 create mode 100644 device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48C8/sai.profile create mode 100644 device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48C8/td3-a7050sx3_48c8-48x10G+8x100G.config.bcm create mode 120000 device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48YC8 create mode 100644 device/arista/x86_64-arista_7050sx3_48c8/default_sku create mode 100644 device/arista/x86_64-arista_7050sx3_48c8/pcie.yaml create mode 120000 device/arista/x86_64-arista_7050sx3_48c8/platform_reboot create mode 120000 device/arista/x86_64-arista_7050sx3_48c8/plugins/eeprom.py create mode 120000 device/arista/x86_64-arista_7050sx3_48c8/plugins/led_control.py create mode 120000 device/arista/x86_64-arista_7050sx3_48c8/plugins/psuutil.py create mode 120000 device/arista/x86_64-arista_7050sx3_48c8/plugins/sfputil.py create mode 120000 device/arista/x86_64-arista_7050sx3_48c8/pmon_daemon_control.json create mode 120000 device/arista/x86_64-arista_7050sx3_48c8/sensors.conf create mode 120000 device/arista/x86_64-arista_7050sx3_48c8/system_health_monitoring_config.json create mode 120000 device/arista/x86_64-arista_7050sx3_48c8/thermal_policy.json create mode 100644 device/arista/x86_64-arista_7050sx3_48yc8/pcie.yaml create mode 100644 device/arista/x86_64-arista_7060dx4_32/pcie.yaml create mode 100644 device/arista/x86_64-arista_7060px4_32/pcie.yaml create mode 100644 device/arista/x86_64-arista_7170_64c/pcie.yaml create mode 100644 device/arista/x86_64-arista_7280cr3_32p4/Arista-7280CR3-C32P4/sai.profile diff --git a/device/arista/x86_64-arista_7050_qx32/pcie.yaml b/device/arista/x86_64-arista_7050_qx32/pcie.yaml new file mode 100644 index 000000000000..3fca76f5cdc7 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/pcie.yaml @@ -0,0 +1,148 @@ +- bus: '00' + dev: '00' + fn: '0' + id: '9601' + name: 'Host bridge: Advanced Micro Devices, Inc. [AMD] RS880 Host Bridge' +- bus: '00' + dev: '01' + fn: '0' + id: '9602' + name: 'PCI bridge: Advanced Micro Devices, Inc. [AMD] RS780/RS880 PCI to PCI bridge + (int gfx)' +- bus: '00' + dev: '04' + fn: '0' + id: '9604' + name: 'PCI bridge: Advanced Micro Devices, Inc. [AMD] RS780/RS880 PCI to PCI bridge + (PCIE port 0)' +- bus: '00' + dev: 08 + fn: '0' + id: 960a + name: 'PCI bridge: Advanced Micro Devices, Inc. [AMD] RS780 PCI to PCI bridge (NB-SB + link)' +- bus: '00' + dev: 09 + fn: '0' + id: '9608' + name: 'PCI bridge: Advanced Micro Devices, Inc. [AMD] RS780/RS880 PCI to PCI bridge + (PCIE port 4)' +- bus: '00' + dev: 0a + fn: '0' + id: '9609' + name: 'PCI bridge: Advanced Micro Devices, Inc. [AMD] RS780/RS880 PCI to PCI bridge + (PCIE port 5)' +- bus: '00' + dev: '11' + fn: '0' + id: '4390' + name: 'SATA controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 + SATA Controller [IDE mode]' +- bus: '00' + dev: '12' + fn: '0' + id: '4397' + name: 'USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 + USB OHCI0 Controller' +- bus: '00' + dev: '12' + fn: '2' + id: '4396' + name: 'USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 + USB EHCI Controller' +- bus: '00' + dev: '13' + fn: '0' + id: '4397' + name: 'USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 + USB OHCI0 Controller' +- bus: '00' + dev: '13' + fn: '2' + id: '4396' + name: 'USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 + USB EHCI Controller' +- bus: '00' + dev: '14' + fn: '0' + id: '4385' + name: 'SMBus: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 SMBus Controller (rev + 42)' +- bus: '00' + dev: '14' + fn: '3' + id: 439d + name: 'ISA bridge: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 LPC + host controller (rev 40)' +- bus: '00' + dev: '14' + fn: '4' + id: '4384' + name: 'PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 PCI to PCI Bridge + (rev 40)' +- bus: '00' + dev: '14' + fn: '6' + id: '1699' + name: 'Ethernet controller: Broadcom Limited NetLink BCM5785 Gigabit Ethernet (rev + 01)' +- bus: '00' + dev: '16' + fn: '0' + id: '4397' + name: 'USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 + USB OHCI0 Controller' +- bus: '00' + dev: '16' + fn: '2' + id: '4396' + name: 'USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 + USB EHCI Controller' +- bus: '00' + dev: '18' + fn: '0' + id: '1200' + name: 'Host bridge: Advanced Micro Devices, Inc. [AMD] Family 10h Processor HyperTransport + Configuration' +- bus: '00' + dev: '18' + fn: '1' + id: '1201' + name: 'Host bridge: Advanced Micro Devices, Inc. [AMD] Family 10h Processor Address + Map' +- bus: '00' + dev: '18' + fn: '2' + id: '1202' + name: 'Host bridge: Advanced Micro Devices, Inc. [AMD] Family 10h Processor DRAM + Controller' +- bus: '00' + dev: '18' + fn: '3' + id: '1203' + name: 'Host bridge: Advanced Micro Devices, Inc. [AMD] Family 10h Processor Miscellaneous + Control' +- bus: '00' + dev: '18' + fn: '4' + id: '1204' + name: 'Host bridge: Advanced Micro Devices, Inc. [AMD] Family 10h Processor Link + Control' +- bus: '01' + dev: '05' + fn: '0' + id: '9712' + name: 'VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] RS880M + [Mobility Radeon HD 4225/4250]' +- bus: '02' + dev: '00' + fn: '0' + id: b850 + name: 'Ethernet controller: Broadcom Limited Broadcom BCM56850 Switch ASIC (rev + 03)' +- bus: '04' + dev: '00' + fn: '0' + id: '0001' + name: 'System peripheral: Arastra Inc. Device 0001 (rev 01)' diff --git a/device/arista/x86_64-arista_7050sx3_48c8 b/device/arista/x86_64-arista_7050sx3_48c8 deleted file mode 120000 index 0334c5411d31..000000000000 --- a/device/arista/x86_64-arista_7050sx3_48c8 +++ /dev/null @@ -1 +0,0 @@ -x86_64-arista_7050sx3_48yc8 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48C8/buffers.json.j2 b/device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48C8/buffers.json.j2 new file mode 100644 index 000000000000..1083a6210fc9 --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48C8/buffers.json.j2 @@ -0,0 +1,2 @@ +{%- set default_topo = 't0' %} +{%- include 'buffers_config.j2' %} diff --git a/device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48C8/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48C8/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..9483fdf77ea1 --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48C8/buffers_defaults_t0.j2 @@ -0,0 +1,49 @@ +{%- set default_cable = '5m' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,48) %} + {%- if PORT_ALL.append("Ethernet%d" % port_idx) %}{%- endif %} + {%- endfor %} + {%- for port_idx in range(0,8) %} + {%- if PORT_ALL.append("Ethernet%d" % (48 + port_idx * 4)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "10875072", + "type": "ingress", + "mode": "dynamic", + "xoff": "4194112" + }, + "egress_lossy_pool": { + "size": "9243812", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "15982720", + "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":"1518", + "static_th":"15982720" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, +{%- endmacro %} diff --git a/device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48C8/pg_profile_lookup.ini b/device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48C8/pg_profile_lookup.ini new file mode 100644 index 000000000000..0b5d680edda7 --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48C8/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 10000 5m 1248 2288 35776 0 2288 + 25000 5m 1248 2288 53248 0 2288 + 40000 5m 1248 2288 66560 0 2288 + 50000 5m 1248 2288 79872 0 2288 + 100000 5m 1248 2288 165568 0 2288 + 10000 40m 1248 2288 37024 0 2288 + 25000 40m 1248 2288 56160 0 2288 + 40000 40m 1248 2288 71552 0 2288 + 50000 40m 1248 2288 85696 0 2288 + 100000 40m 1248 2288 177632 0 2288 + 10000 300m 1248 2288 46176 0 2288 + 25000 300m 1248 2288 79040 0 2288 + 40000 300m 1248 2288 108160 0 2288 + 50000 300m 1248 2288 141856 0 2288 + 100000 300m 1248 2288 268736 0 2288 diff --git a/device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48C8/port_config.ini b/device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48C8/port_config.ini new file mode 100644 index 000000000000..da3a72aa6f99 --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48C8/port_config.ini @@ -0,0 +1,57 @@ +# name lanes alias index speed +Ethernet0 1 Ethernet1 1 10000 +Ethernet1 2 Ethernet2 2 10000 +Ethernet2 3 Ethernet3 3 10000 +Ethernet3 4 Ethernet4 4 10000 +Ethernet4 5 Ethernet5 5 10000 +Ethernet5 6 Ethernet6 6 10000 +Ethernet6 7 Ethernet7 7 10000 +Ethernet7 8 Ethernet8 8 10000 +Ethernet8 9 Ethernet9 9 10000 +Ethernet9 10 Ethernet10 10 10000 +Ethernet10 11 Ethernet11 11 10000 +Ethernet11 12 Ethernet12 12 10000 +Ethernet12 13 Ethernet13 13 10000 +Ethernet13 14 Ethernet14 14 10000 +Ethernet14 15 Ethernet15 15 10000 +Ethernet15 16 Ethernet16 16 10000 +Ethernet16 17 Ethernet17 17 10000 +Ethernet17 18 Ethernet18 18 10000 +Ethernet18 19 Ethernet19 19 10000 +Ethernet19 20 Ethernet20 20 10000 +Ethernet20 21 Ethernet21 21 10000 +Ethernet21 22 Ethernet22 22 10000 +Ethernet22 23 Ethernet23 23 10000 +Ethernet23 24 Ethernet24 24 10000 +Ethernet24 57 Ethernet25 25 10000 +Ethernet25 58 Ethernet26 26 10000 +Ethernet26 59 Ethernet27 27 10000 +Ethernet27 60 Ethernet28 28 10000 +Ethernet28 61 Ethernet29 29 10000 +Ethernet29 62 Ethernet30 30 10000 +Ethernet30 63 Ethernet31 31 10000 +Ethernet31 64 Ethernet32 32 10000 +Ethernet32 65 Ethernet33 33 10000 +Ethernet33 66 Ethernet34 34 10000 +Ethernet34 67 Ethernet35 35 10000 +Ethernet35 68 Ethernet36 36 10000 +Ethernet36 69 Ethernet37 37 10000 +Ethernet37 70 Ethernet38 38 10000 +Ethernet38 71 Ethernet39 39 10000 +Ethernet39 72 Ethernet40 40 10000 +Ethernet40 73 Ethernet41 41 10000 +Ethernet41 74 Ethernet42 42 10000 +Ethernet42 75 Ethernet43 43 10000 +Ethernet43 76 Ethernet44 44 10000 +Ethernet44 77 Ethernet45 45 10000 +Ethernet45 78 Ethernet46 46 10000 +Ethernet46 79 Ethernet47 47 10000 +Ethernet47 80 Ethernet48 48 10000 +Ethernet48 25,26,27,28 Ethernet49/1 49 100000 +Ethernet52 29,30,31,32 Ethernet50/1 50 100000 +Ethernet56 33,34,35,36 Ethernet51/1 51 100000 +Ethernet60 37,38,39,40 Ethernet52/1 52 100000 +Ethernet64 41,42,43,44 Ethernet53/1 53 100000 +Ethernet68 45,46,47,48 Ethernet54/1 54 100000 +Ethernet72 49,50,51,52 Ethernet55/1 55 100000 +Ethernet76 53,54,55,56 Ethernet56/1 56 100000 diff --git a/device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48C8/qos.json.j2 b/device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48C8/qos.json.j2 new file mode 100644 index 000000000000..34002048afdb --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48C8/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_7050sx3_48c8/Arista-7050SX3-48C8/sai.profile b/device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48C8/sai.profile new file mode 100644 index 000000000000..4bea17252256 --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48C8/sai.profile @@ -0,0 +1,2 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/td3-a7050sx3_48c8-48x10G+8x100G.config.bcm +SAI_NUM_ECMP_MEMBERS=64 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 new file mode 100644 index 000000000000..18d173be6c1a --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48C8/td3-a7050sx3_48c8-48x10G+8x100G.config.bcm @@ -0,0 +1,541 @@ +PHY_AN_ALLOW_PLL_CHANGE=1 +arl_clean_timeout_usec=15000000 +asf_mem_profile=2 +bcm_num_cos=8 +bcm_stat_flags=1 +bcm_stat_jumbo=9236 +bcm_tunnel_term_compatible_mode=1 +cdma_timeout_usec=15000000 +core_clock_frequency=1525 +dma_desc_timeout_usec=15000000 +dpp_clock_ratio=2:3 +fpem_mem_entries=0 +higig2_hdr_mode=1 +ifp_inports_support_enable=1 +ipv6_lpm_128b_enable=0 +l2xmsg_mode=1 +l2_mem_entries=163840 +l3_alpm_enable=2 +l3_max_ecmp_mode=1 +l3_mem_entries=147456 +max_vp_lags=0 +miim_intr_enable=0 +module_64ports=1 +multicast_l2_range=16383 +multicast_l3_range=0 +os=unix +oversubscribe_mode=1 +pbmp_xport_xe=0x1ffffffe1ffffffe +phy_an_c73_1=1 +phy_an_c73_2=1 +phy_an_c73_3=1 +phy_an_c73_4=1 +phy_an_c73_5=1 +phy_an_c73_6=1 +phy_an_c73_7=1 +phy_an_c73_8=1 +phy_an_c73_9=1 +phy_an_c73_10=1 +phy_an_c73_11=1 +phy_an_c73_12=1 +phy_an_c73_13=1 +phy_an_c73_14=1 +phy_an_c73_15=1 +phy_an_c73_16=1 +phy_an_c73_17=1 +phy_an_c73_18=1 +phy_an_c73_19=1 +phy_an_c73_20=1 +phy_an_c73_21=1 +phy_an_c73_22=1 +phy_an_c73_23=1 +phy_an_c73_24=1 +phy_an_c73_25=0 +phy_an_c73_26=0 +phy_an_c73_27=0 +phy_an_c73_28=0 +phy_an_c73_33=1 +phy_an_c73_34=1 +phy_an_c73_35=1 +phy_an_c73_36=1 +phy_an_c73_37=1 +phy_an_c73_38=1 +phy_an_c73_39=1 +phy_an_c73_40=1 +phy_an_c73_41=1 +phy_an_c73_42=1 +phy_an_c73_43=1 +phy_an_c73_44=1 +phy_an_c73_45=1 +phy_an_c73_46=1 +phy_an_c73_47=1 +phy_an_c73_48=1 +phy_an_c73_49=1 +phy_an_c73_50=1 +phy_an_c73_51=1 +phy_an_c73_52=1 +phy_an_c73_53=1 +phy_an_c73_54=1 +phy_an_c73_55=1 +phy_an_c73_56=1 +phy_an_c73_57=0 +phy_an_c73_58=0 +phy_an_c73_59=0 +phy_an_c73_60=0 +phy_chain_rx_lane_map_physical{1.0}=0x0123 +phy_chain_rx_lane_map_physical{5.0}=0x0123 +phy_chain_rx_lane_map_physical{9.0}=0x0123 +phy_chain_rx_lane_map_physical{13.0}=0x0123 +phy_chain_rx_lane_map_physical{17.0}=0x0123 +phy_chain_rx_lane_map_physical{21.0}=0x0123 +phy_chain_rx_lane_map_physical{25.0}=0x0213 +phy_chain_rx_lane_map_physical{29.0}=0x2031 +phy_chain_rx_lane_map_physical{33.0}=0x1302 +phy_chain_rx_lane_map_physical{37.0}=0x3120 +phy_chain_rx_lane_map_physical{41.0}=0x2031 +phy_chain_rx_lane_map_physical{45.0}=0x0213 +phy_chain_rx_lane_map_physical{49.0}=0x2031 +phy_chain_rx_lane_map_physical{53.0}=0x0213 +phy_chain_rx_lane_map_physical{57.0}=0x3210 +phy_chain_rx_lane_map_physical{61.0}=0x3210 +phy_chain_rx_lane_map_physical{65.0}=0x3210 +phy_chain_rx_lane_map_physical{69.0}=0x3210 +phy_chain_rx_lane_map_physical{73.0}=0x3210 +phy_chain_rx_lane_map_physical{77.0}=0x3210 +phy_chain_rx_polarity_flip_physical{1.0}=0x0 +phy_chain_rx_polarity_flip_physical{2.0}=0x1 +phy_chain_rx_polarity_flip_physical{3.0}=0x0 +phy_chain_rx_polarity_flip_physical{4.0}=0x1 +phy_chain_rx_polarity_flip_physical{5.0}=0x1 +phy_chain_rx_polarity_flip_physical{6.0}=0x0 +phy_chain_rx_polarity_flip_physical{7.0}=0x1 +phy_chain_rx_polarity_flip_physical{8.0}=0x0 +phy_chain_rx_polarity_flip_physical{9.0}=0x1 +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}=0x0 +phy_chain_rx_polarity_flip_physical{13.0}=0x1 +phy_chain_rx_polarity_flip_physical{14.0}=0x0 +phy_chain_rx_polarity_flip_physical{15.0}=0x1 +phy_chain_rx_polarity_flip_physical{16.0}=0x0 +phy_chain_rx_polarity_flip_physical{17.0}=0x0 +phy_chain_rx_polarity_flip_physical{18.0}=0x1 +phy_chain_rx_polarity_flip_physical{19.0}=0x0 +phy_chain_rx_polarity_flip_physical{20.0}=0x1 +phy_chain_rx_polarity_flip_physical{21.0}=0x1 +phy_chain_rx_polarity_flip_physical{22.0}=0x0 +phy_chain_rx_polarity_flip_physical{23.0}=0x1 +phy_chain_rx_polarity_flip_physical{24.0}=0x0 +phy_chain_rx_polarity_flip_physical{25.0}=0x0 +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{29.0}=0x0 +phy_chain_rx_polarity_flip_physical{30.0}=0x0 +phy_chain_rx_polarity_flip_physical{31.0}=0x1 +phy_chain_rx_polarity_flip_physical{32.0}=0x1 +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{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{41.0}=0x1 +phy_chain_rx_polarity_flip_physical{42.0}=0x0 +phy_chain_rx_polarity_flip_physical{43.0}=0x0 +phy_chain_rx_polarity_flip_physical{44.0}=0x1 +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}=0x1 +phy_chain_rx_polarity_flip_physical{49.0}=0x0 +phy_chain_rx_polarity_flip_physical{50.0}=0x0 +phy_chain_rx_polarity_flip_physical{51.0}=0x0 +phy_chain_rx_polarity_flip_physical{52.0}=0x1 +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}=0x1 +phy_chain_rx_polarity_flip_physical{57.0}=0x0 +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}=0x1 +phy_chain_rx_polarity_flip_physical{61.0}=0x1 +phy_chain_rx_polarity_flip_physical{62.0}=0x0 +phy_chain_rx_polarity_flip_physical{63.0}=0x1 +phy_chain_rx_polarity_flip_physical{64.0}=0x0 +phy_chain_rx_polarity_flip_physical{65.0}=0x0 +phy_chain_rx_polarity_flip_physical{66.0}=0x1 +phy_chain_rx_polarity_flip_physical{67.0}=0x0 +phy_chain_rx_polarity_flip_physical{68.0}=0x1 +phy_chain_rx_polarity_flip_physical{69.0}=0x0 +phy_chain_rx_polarity_flip_physical{70.0}=0x1 +phy_chain_rx_polarity_flip_physical{71.0}=0x0 +phy_chain_rx_polarity_flip_physical{72.0}=0x1 +phy_chain_rx_polarity_flip_physical{73.0}=0x0 +phy_chain_rx_polarity_flip_physical{74.0}=0x1 +phy_chain_rx_polarity_flip_physical{75.0}=0x0 +phy_chain_rx_polarity_flip_physical{76.0}=0x1 +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}=0x1 +phy_chain_rx_polarity_flip_physical{80.0}=0x0 +phy_chain_tx_lane_map_physical{1.0}=0x0123 +phy_chain_tx_lane_map_physical{5.0}=0x0123 +phy_chain_tx_lane_map_physical{9.0}=0x0123 +phy_chain_tx_lane_map_physical{13.0}=0x0123 +phy_chain_tx_lane_map_physical{17.0}=0x0123 +phy_chain_tx_lane_map_physical{21.0}=0x0123 +phy_chain_tx_lane_map_physical{25.0}=0x0123 +phy_chain_tx_lane_map_physical{29.0}=0x3210 +phy_chain_tx_lane_map_physical{33.0}=0x0123 +phy_chain_tx_lane_map_physical{37.0}=0x3201 +phy_chain_tx_lane_map_physical{41.0}=0x3201 +phy_chain_tx_lane_map_physical{45.0}=0x0123 +phy_chain_tx_lane_map_physical{49.0}=0x3201 +phy_chain_tx_lane_map_physical{53.0}=0x0132 +phy_chain_tx_lane_map_physical{57.0}=0x3210 +phy_chain_tx_lane_map_physical{61.0}=0x3210 +phy_chain_tx_lane_map_physical{65.0}=0x3210 +phy_chain_tx_lane_map_physical{69.0}=0x3210 +phy_chain_tx_lane_map_physical{73.0}=0x3210 +phy_chain_tx_lane_map_physical{77.0}=0x3210 +phy_chain_tx_polarity_flip_physical{1.0}=0x0 +phy_chain_tx_polarity_flip_physical{2.0}=0x0 +phy_chain_tx_polarity_flip_physical{3.0}=0x0 +phy_chain_tx_polarity_flip_physical{4.0}=0x0 +phy_chain_tx_polarity_flip_physical{5.0}=0x0 +phy_chain_tx_polarity_flip_physical{6.0}=0x0 +phy_chain_tx_polarity_flip_physical{7.0}=0x0 +phy_chain_tx_polarity_flip_physical{8.0}=0x0 +phy_chain_tx_polarity_flip_physical{9.0}=0x0 +phy_chain_tx_polarity_flip_physical{10.0}=0x0 +phy_chain_tx_polarity_flip_physical{11.0}=0x0 +phy_chain_tx_polarity_flip_physical{12.0}=0x0 +phy_chain_tx_polarity_flip_physical{13.0}=0x0 +phy_chain_tx_polarity_flip_physical{14.0}=0x0 +phy_chain_tx_polarity_flip_physical{15.0}=0x0 +phy_chain_tx_polarity_flip_physical{16.0}=0x0 +phy_chain_tx_polarity_flip_physical{17.0}=0x0 +phy_chain_tx_polarity_flip_physical{18.0}=0x0 +phy_chain_tx_polarity_flip_physical{19.0}=0x0 +phy_chain_tx_polarity_flip_physical{20.0}=0x0 +phy_chain_tx_polarity_flip_physical{21.0}=0x0 +phy_chain_tx_polarity_flip_physical{22.0}=0x0 +phy_chain_tx_polarity_flip_physical{23.0}=0x0 +phy_chain_tx_polarity_flip_physical{24.0}=0x0 +phy_chain_tx_polarity_flip_physical{25.0}=0x0 +phy_chain_tx_polarity_flip_physical{26.0}=0x0 +phy_chain_tx_polarity_flip_physical{27.0}=0x0 +phy_chain_tx_polarity_flip_physical{28.0}=0x0 +phy_chain_tx_polarity_flip_physical{29.0}=0x0 +phy_chain_tx_polarity_flip_physical{30.0}=0x0 +phy_chain_tx_polarity_flip_physical{31.0}=0x0 +phy_chain_tx_polarity_flip_physical{32.0}=0x0 +phy_chain_tx_polarity_flip_physical{33.0}=0x0 +phy_chain_tx_polarity_flip_physical{34.0}=0x0 +phy_chain_tx_polarity_flip_physical{35.0}=0x0 +phy_chain_tx_polarity_flip_physical{36.0}=0x0 +phy_chain_tx_polarity_flip_physical{37.0}=0x0 +phy_chain_tx_polarity_flip_physical{38.0}=0x0 +phy_chain_tx_polarity_flip_physical{39.0}=0x0 +phy_chain_tx_polarity_flip_physical{40.0}=0x1 +phy_chain_tx_polarity_flip_physical{41.0}=0x0 +phy_chain_tx_polarity_flip_physical{42.0}=0x0 +phy_chain_tx_polarity_flip_physical{43.0}=0x0 +phy_chain_tx_polarity_flip_physical{44.0}=0x0 +phy_chain_tx_polarity_flip_physical{45.0}=0x0 +phy_chain_tx_polarity_flip_physical{46.0}=0x0 +phy_chain_tx_polarity_flip_physical{47.0}=0x0 +phy_chain_tx_polarity_flip_physical{48.0}=0x1 +phy_chain_tx_polarity_flip_physical{49.0}=0x1 +phy_chain_tx_polarity_flip_physical{50.0}=0x0 +phy_chain_tx_polarity_flip_physical{51.0}=0x0 +phy_chain_tx_polarity_flip_physical{52.0}=0x0 +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}=0x0 +phy_chain_tx_polarity_flip_physical{56.0}=0x0 +phy_chain_tx_polarity_flip_physical{57.0}=0x1 +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}=0x1 +phy_chain_tx_polarity_flip_physical{61.0}=0x1 +phy_chain_tx_polarity_flip_physical{62.0}=0x1 +phy_chain_tx_polarity_flip_physical{63.0}=0x1 +phy_chain_tx_polarity_flip_physical{64.0}=0x0 +phy_chain_tx_polarity_flip_physical{65.0}=0x0 +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}=0x0 +phy_chain_tx_polarity_flip_physical{69.0}=0x0 +phy_chain_tx_polarity_flip_physical{70.0}=0x0 +phy_chain_tx_polarity_flip_physical{71.0}=0x0 +phy_chain_tx_polarity_flip_physical{72.0}=0x0 +phy_chain_tx_polarity_flip_physical{73.0}=0x0 +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}=0x0 +phy_chain_tx_polarity_flip_physical{77.0}=0x0 +phy_chain_tx_polarity_flip_physical{78.0}=0x0 +phy_chain_tx_polarity_flip_physical{79.0}=0x0 +phy_chain_tx_polarity_flip_physical{80.0}=0x0 +portmap_1=1:10 +portmap_2=2:10 +portmap_3=3:10 +portmap_4=4:10 +portmap_5=5:10 +portmap_6=6:10 +portmap_7=7:10 +portmap_8=8:10 +portmap_9=9:10 +portmap_10=10:10 +portmap_11=11:10 +portmap_12=12:10 +portmap_13=13:10 +portmap_14=14:10 +portmap_15=15:10 +portmap_16=16:10 +portmap_17=17:10 +portmap_18=18:10 +portmap_19=19:10 +portmap_20=20:10 +portmap_21=21:10 +portmap_22=22:10 +portmap_23=23:10 +portmap_24=24:10 +portmap_25=25:100 +portmap_26=29:100 +portmap_27=33:100 +portmap_28=37:100 +portmap_33=57:10 +portmap_34=58:10 +portmap_35=59:10 +portmap_36=60:10 +portmap_37=61:10 +portmap_38=62:10 +portmap_39=63:10 +portmap_40=64:10 +portmap_41=65:10 +portmap_42=66:10 +portmap_43=67:10 +portmap_44=68:10 +portmap_45=69:10 +portmap_46=70:10 +portmap_47=71:10 +portmap_48=72:10 +portmap_49=73:10 +portmap_50=74:10 +portmap_51=75:10 +portmap_52=76:10 +portmap_53=77:10 +portmap_54=78:10 +portmap_55=79:10 +portmap_56=80:10 +portmap_57=41:100 +portmap_58=45:100 +portmap_59=49:100 +portmap_60=53:100 +port_flex_enable=1 +port_init_autoneg_1=0 +port_init_autoneg_5=0 +port_init_autoneg_9=0 +port_init_autoneg_13=0 +port_init_autoneg_17=0 +port_init_autoneg_21=0 +port_init_autoneg_25=0 +port_init_autoneg_26=0 +port_init_autoneg_27=0 +port_init_autoneg_28=0 +port_init_autoneg_33=0 +port_init_autoneg_37=0 +port_init_autoneg_41=0 +port_init_autoneg_45=0 +port_init_autoneg_49=0 +port_init_autoneg_53=0 +port_init_autoneg_57=0 +port_init_autoneg_58=0 +port_init_autoneg_59=0 +port_init_autoneg_60=0 +port_phy_addr_1=0xff +port_phy_addr_5=0xff +port_phy_addr_9=0xff +port_phy_addr_13=0xff +port_phy_addr_17=0xff +port_phy_addr_21=0xff +port_phy_addr_25=0xff +port_phy_addr_26=0xff +port_phy_addr_27=0xff +port_phy_addr_28=0xff +port_phy_addr_33=0xff +port_phy_addr_37=0xff +port_phy_addr_41=0xff +port_phy_addr_45=0xff +port_phy_addr_49=0xff +port_phy_addr_53=0xff +port_phy_addr_57=0xff +port_phy_addr_58=0xff +port_phy_addr_59=0xff +port_phy_addr_60=0xff +robust_hash_disable_egress_vlan=1 +robust_hash_disable_mpls=1 +robust_hash_disable_vlan=1 +serdes_core_rx_polarity_flip_physical{1}=0xa +serdes_core_rx_polarity_flip_physical{5}=0x5 +serdes_core_rx_polarity_flip_physical{9}=0x5 +serdes_core_rx_polarity_flip_physical{13}=0x5 +serdes_core_rx_polarity_flip_physical{17}=0xa +serdes_core_rx_polarity_flip_physical{21}=0x5 +serdes_core_rx_polarity_flip_physical{25}=0x0 +serdes_core_rx_polarity_flip_physical{29}=0xc +serdes_core_rx_polarity_flip_physical{33}=0x3 +serdes_core_rx_polarity_flip_physical{37}=0x1 +serdes_core_rx_polarity_flip_physical{41}=0x9 +serdes_core_rx_polarity_flip_physical{45}=0x9 +serdes_core_rx_polarity_flip_physical{49}=0x8 +serdes_core_rx_polarity_flip_physical{53}=0x9 +serdes_core_rx_polarity_flip_physical{57}=0xa +serdes_core_rx_polarity_flip_physical{61}=0x5 +serdes_core_rx_polarity_flip_physical{65}=0xa +serdes_core_rx_polarity_flip_physical{69}=0xa +serdes_core_rx_polarity_flip_physical{73}=0xa +serdes_core_rx_polarity_flip_physical{77}=0x5 +serdes_core_tx_polarity_flip_physical{1}=0x0 +serdes_core_tx_polarity_flip_physical{5}=0x0 +serdes_core_tx_polarity_flip_physical{9}=0x0 +serdes_core_tx_polarity_flip_physical{13}=0x0 +serdes_core_tx_polarity_flip_physical{17}=0x0 +serdes_core_tx_polarity_flip_physical{21}=0x0 +serdes_core_tx_polarity_flip_physical{25}=0x0 +serdes_core_tx_polarity_flip_physical{29}=0x0 +serdes_core_tx_polarity_flip_physical{33}=0x0 +serdes_core_tx_polarity_flip_physical{37}=0x8 +serdes_core_tx_polarity_flip_physical{41}=0x0 +serdes_core_tx_polarity_flip_physical{45}=0x8 +serdes_core_tx_polarity_flip_physical{49}=0x1 +serdes_core_tx_polarity_flip_physical{53}=0x0 +serdes_core_tx_polarity_flip_physical{57}=0xf +serdes_core_tx_polarity_flip_physical{61}=0x7 +serdes_core_tx_polarity_flip_physical{65}=0x0 +serdes_core_tx_polarity_flip_physical{69}=0x0 +serdes_core_tx_polarity_flip_physical{73}=0x0 +serdes_core_tx_polarity_flip_physical{77}=0x0 +tdma_timeout_usec=15000000 +tslam_timeout_usec=15000000 +disable_pcie_firmware_check=1 + +# tuning +serdes_driver_current_1=0xf +serdes_driver_current_2=0xf +serdes_driver_current_3=0xf +serdes_driver_current_4=0xf +serdes_driver_current_5=0xf +serdes_driver_current_6=0xf +serdes_driver_current_7=0xf +serdes_driver_current_8=0xf +serdes_driver_current_9=0xf +serdes_driver_current_10=0xf +serdes_driver_current_11=0xf +serdes_driver_current_12=0xf +serdes_driver_current_13=0xf +serdes_driver_current_14=0xf +serdes_driver_current_15=0xf +serdes_driver_current_16=0xf +serdes_driver_current_17=0xf +serdes_driver_current_18=0xf +serdes_driver_current_19=0xf +serdes_driver_current_20=0xf +serdes_driver_current_21=0xf +serdes_driver_current_22=0xf +serdes_driver_current_23=0xf +serdes_driver_current_24=0xf +serdes_driver_current_25=0xf +serdes_driver_current_26=0xf +serdes_driver_current_27=0xf +serdes_driver_current_28=0xf +serdes_driver_current_33=0xf +serdes_driver_current_34=0xf +serdes_driver_current_35=0xf +serdes_driver_current_36=0xf +serdes_driver_current_37=0xf +serdes_driver_current_38=0xf +serdes_driver_current_39=0xf +serdes_driver_current_40=0xf +serdes_driver_current_41=0xf +serdes_driver_current_42=0xf +serdes_driver_current_43=0xf +serdes_driver_current_44=0xf +serdes_driver_current_45=0xf +serdes_driver_current_46=0xf +serdes_driver_current_47=0xf +serdes_driver_current_48=0xf +serdes_driver_current_49=0xf +serdes_driver_current_50=0xf +serdes_driver_current_51=0xf +serdes_driver_current_52=0xf +serdes_driver_current_53=0xf +serdes_driver_current_54=0xf +serdes_driver_current_55=0xf +serdes_driver_current_56=0xf +serdes_driver_current_57=0xf +serdes_driver_current_58=0xf +serdes_driver_current_59=0xf +serdes_driver_current_60=0xf +serdes_preemphasis_1=0x164105 +serdes_preemphasis_2=0x164105 +serdes_preemphasis_3=0x164105 +serdes_preemphasis_4=0x164105 +serdes_preemphasis_5=0x164105 +serdes_preemphasis_6=0x164105 +serdes_preemphasis_7=0x164105 +serdes_preemphasis_8=0x164105 +serdes_preemphasis_9=0x164105 +serdes_preemphasis_10=0x164105 +serdes_preemphasis_11=0x164105 +serdes_preemphasis_12=0x164105 +serdes_preemphasis_13=0x164105 +serdes_preemphasis_14=0x164105 +serdes_preemphasis_15=0x164105 +serdes_preemphasis_16=0x124105 +serdes_preemphasis_17=0x123f05 +serdes_preemphasis_18=0x123f05 +serdes_preemphasis_19=0x123f05 +serdes_preemphasis_20=0x123f05 +serdes_preemphasis_21=0x123f05 +serdes_preemphasis_22=0x123f05 +serdes_preemphasis_23=0x103c05 +serdes_preemphasis_24=0x103c05 +serdes_preemphasis_25=0x82e06 +serdes_preemphasis_26=0x92e05 +serdes_preemphasis_27=0x93006 +serdes_preemphasis_28=0x93006 +serdes_preemphasis_33=0x103c05 +serdes_preemphasis_34=0x103c05 +serdes_preemphasis_35=0x123f05 +serdes_preemphasis_36=0x123f05 +serdes_preemphasis_37=0x123f05 +serdes_preemphasis_38=0x123f05 +serdes_preemphasis_39=0x123f05 +serdes_preemphasis_40=0x123f05 +serdes_preemphasis_41=0x124105 +serdes_preemphasis_42=0x164105 +serdes_preemphasis_43=0x164105 +serdes_preemphasis_44=0x164105 +serdes_preemphasis_45=0x164105 +serdes_preemphasis_46=0x164105 +serdes_preemphasis_47=0x164105 +serdes_preemphasis_48=0x164105 +serdes_preemphasis_49=0x164105 +serdes_preemphasis_50=0x164105 +serdes_preemphasis_51=0x164105 +serdes_preemphasis_52=0x164105 +serdes_preemphasis_53=0x164105 +serdes_preemphasis_54=0x164105 +serdes_preemphasis_55=0x164105 +serdes_preemphasis_56=0x144105 +serdes_preemphasis_57=0x93006 +serdes_preemphasis_58=0x93006 +serdes_preemphasis_59=0x82d05 +serdes_preemphasis_60=0x82d05 diff --git a/device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48YC8 b/device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48YC8 new file mode 120000 index 000000000000..bd31d75fbc54 --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48YC8 @@ -0,0 +1 @@ +Arista-7050SX3-48C8 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7050sx3_48c8/default_sku b/device/arista/x86_64-arista_7050sx3_48c8/default_sku new file mode 100644 index 000000000000..014a840dfc1f --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48c8/default_sku @@ -0,0 +1 @@ +Arista-7050SX3-48C8 t1 diff --git a/device/arista/x86_64-arista_7050sx3_48c8/pcie.yaml b/device/arista/x86_64-arista_7050sx3_48c8/pcie.yaml new file mode 100644 index 000000000000..a0e58628f4b7 --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48c8/pcie.yaml @@ -0,0 +1,163 @@ +- bus: '00' + dev: '00' + fn: '0' + id: '1576' + name: 'Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Processor Root Complex' +- bus: '00' + dev: '00' + fn: '2' + id: '1577' + name: 'IOMMU: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) I/O + Memory Management Unit' +- bus: '00' + dev: '02' + fn: '0' + id: 157b + name: 'Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Host Bridge' +- bus: '00' + dev: '02' + fn: '2' + id: 157c + name: 'PCI bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Processor Root Port' +- bus: '00' + dev: '02' + fn: '3' + id: 157c + name: 'PCI bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Processor Root Port' +- bus: '00' + dev: '02' + fn: '4' + id: 157c + name: 'PCI bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Processor Root Port' +- bus: '00' + dev: '02' + fn: '5' + id: 157c + name: 'PCI bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Processor Root Port' +- bus: '00' + dev: '03' + fn: '0' + id: 157b + name: 'Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Host Bridge' +- bus: '00' + dev: '03' + fn: '1' + id: 157c + name: 'PCI bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Processor Root Port' +- bus: '00' + dev: '03' + fn: '2' + id: 157c + name: 'PCI bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Processor Root Port' +- bus: '00' + dev: 08 + fn: '0' + id: '1578' + name: 'Encryption controller: Advanced Micro Devices, Inc. [AMD] Carrizo Platform + Security Processor' +- bus: '00' + dev: 09 + fn: '0' + id: '0001' + name: 'Host bridge: Arastra Inc. Device 0001' +- bus: '00' + dev: 09 + fn: '2' + id: 157a + name: 'Audio device: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Audio Controller' +- bus: '00' + dev: '10' + fn: '0' + id: '7914' + name: 'USB controller: Advanced Micro Devices, Inc. [AMD] FCH USB XHCI Controller + (rev 20)' +- bus: '00' + dev: '11' + fn: '0' + id: '7904' + name: 'SATA controller: Advanced Micro Devices, Inc. [AMD] FCH SATA Controller [AHCI + mode] (rev 49)' +- bus: '00' + dev: '12' + fn: '0' + id: '7908' + name: 'USB controller: Advanced Micro Devices, Inc. [AMD] FCH USB EHCI Controller + (rev 49)' +- bus: '00' + dev: '14' + fn: '0' + id: 790b + name: 'SMBus: Advanced Micro Devices, Inc. [AMD] FCH SMBus Controller (rev 4a)' +- bus: '00' + dev: '14' + fn: '3' + id: 790e + name: 'ISA bridge: Advanced Micro Devices, Inc. [AMD] FCH LPC Bridge (rev 11)' +- bus: '00' + dev: '14' + fn: '7' + id: '7906' + name: 'SD Host controller: Advanced Micro Devices, Inc. [AMD] FCH SD Flash Controller + (rev 01)' +- bus: '00' + dev: '18' + fn: '0' + id: '1570' + name: 'Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Processor Function 0' +- bus: '00' + dev: '18' + fn: '1' + id: '1571' + name: 'Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Processor Function 1' +- bus: '00' + dev: '18' + fn: '2' + id: '1572' + name: 'Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Processor Function 2' +- bus: '00' + dev: '18' + fn: '3' + id: '1573' + name: 'Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Processor Function 3' +- bus: '00' + dev: '18' + fn: '4' + id: '1574' + name: 'Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Processor Function 4' +- bus: '00' + dev: '18' + fn: '5' + id: '1575' + name: 'Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Processor Function 5' +- bus: '01' + dev: '00' + fn: '0' + id: '1682' + name: 'Ethernet controller: Broadcom Limited NetXtreme BCM57762 Gigabit Ethernet + PCIe (rev 01)' +- bus: '02' + dev: '00' + fn: '0' + id: '0001' + name: 'System peripheral: Arastra Inc. Device 0001 (rev 01)' +- bus: '05' + dev: '00' + fn: '0' + id: b771 + name: 'Ethernet controller: Broadcom Limited Device b771 (rev 01)' diff --git a/device/arista/x86_64-arista_7050sx3_48c8/platform_reboot b/device/arista/x86_64-arista_7050sx3_48c8/platform_reboot new file mode 120000 index 000000000000..7f94a49e38b0 --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48c8/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_7050sx3_48c8/plugins/eeprom.py b/device/arista/x86_64-arista_7050sx3_48c8/plugins/eeprom.py new file mode 120000 index 000000000000..35cfaff3de4e --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48c8/plugins/eeprom.py @@ -0,0 +1 @@ +../../x86_64-arista_common/plugins/eeprom.py \ No newline at end of file diff --git a/device/arista/x86_64-arista_7050sx3_48c8/plugins/led_control.py b/device/arista/x86_64-arista_7050sx3_48c8/plugins/led_control.py new file mode 120000 index 000000000000..8d733780117e --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48c8/plugins/led_control.py @@ -0,0 +1 @@ +../../x86_64-arista_common/plugins/led_control.py \ No newline at end of file diff --git a/device/arista/x86_64-arista_7050sx3_48c8/plugins/psuutil.py b/device/arista/x86_64-arista_7050sx3_48c8/plugins/psuutil.py new file mode 120000 index 000000000000..2b0024ade969 --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48c8/plugins/psuutil.py @@ -0,0 +1 @@ +../../x86_64-arista_common/plugins/psuutil.py \ No newline at end of file diff --git a/device/arista/x86_64-arista_7050sx3_48c8/plugins/sfputil.py b/device/arista/x86_64-arista_7050sx3_48c8/plugins/sfputil.py new file mode 120000 index 000000000000..c333e23763d7 --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48c8/plugins/sfputil.py @@ -0,0 +1 @@ +../../x86_64-arista_common/plugins/sfputil.py \ No newline at end of file diff --git a/device/arista/x86_64-arista_7050sx3_48c8/pmon_daemon_control.json b/device/arista/x86_64-arista_7050sx3_48c8/pmon_daemon_control.json new file mode 120000 index 000000000000..51d5ab7b0059 --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48c8/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_7050sx3_48c8/sensors.conf b/device/arista/x86_64-arista_7050sx3_48c8/sensors.conf new file mode 120000 index 000000000000..91dcc5e17d18 --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48c8/sensors.conf @@ -0,0 +1 @@ +../x86_64-arista_7050sx3_48yc8/sensors.conf \ No newline at end of file diff --git a/device/arista/x86_64-arista_7050sx3_48c8/system_health_monitoring_config.json b/device/arista/x86_64-arista_7050sx3_48c8/system_health_monitoring_config.json new file mode 120000 index 000000000000..1185f771fa8e --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48c8/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_7050sx3_48c8/thermal_policy.json b/device/arista/x86_64-arista_7050sx3_48c8/thermal_policy.json new file mode 120000 index 000000000000..0991dc7f3638 --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48c8/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_7050sx3_48yc8/Arista-7050SX3-48YC8/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7050sx3_48yc8/Arista-7050SX3-48YC8/buffers_defaults_t0.j2 index b6e6a948928d..9483fdf77ea1 100644 --- a/device/arista/x86_64-arista_7050sx3_48yc8/Arista-7050SX3-48YC8/buffers_defaults_t0.j2 +++ b/device/arista/x86_64-arista_7050sx3_48yc8/Arista-7050SX3-48YC8/buffers_defaults_t0.j2 @@ -2,12 +2,11 @@ {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} - {%- for port_idx in range(0,28) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} + {%- for port_idx in range(0,48) %} + {%- if PORT_ALL.append("Ethernet%d" % port_idx) %}{%- endif %} {%- endfor %} - {%- for port_idx in range(28,32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- for port_idx in range(0,8) %} + {%- if PORT_ALL.append("Ethernet%d" % (48 + port_idx * 4)) %}{%- endif %} {%- endfor %} {%- endmacro %} diff --git a/device/arista/x86_64-arista_7050sx3_48yc8/Arista-7050SX3-48YC8/port_config.ini b/device/arista/x86_64-arista_7050sx3_48yc8/Arista-7050SX3-48YC8/port_config.ini index bccaa602f203..fb48d159af10 100644 --- a/device/arista/x86_64-arista_7050sx3_48yc8/Arista-7050SX3-48YC8/port_config.ini +++ b/device/arista/x86_64-arista_7050sx3_48yc8/Arista-7050SX3-48YC8/port_config.ini @@ -1,57 +1,57 @@ # name lanes alias index speed -Ethernet0 1,2 Ethernet1/1 1 25000 -Ethernet2 3,4 Ethernet1/3 1 25000 -Ethernet4 5,6 Ethernet2/1 2 25000 -Ethernet6 7,8 Ethernet2/3 2 25000 -Ethernet8 9,10 Ethernet3/1 3 25000 -Ethernet10 11,12 Ethernet3/3 3 25000 -Ethernet12 13,14 Ethernet4/1 4 25000 -Ethernet14 15,16 Ethernet4/3 4 25000 -Ethernet16 21,22 Ethernet5/1 5 25000 -Ethernet18 23,24 Ethernet5/3 5 25000 -Ethernet20 17,18 Ethernet6/1 6 25000 -Ethernet22 19,20 Ethernet6/3 6 25000 -Ethernet24 25,26 Ethernet7/1 7 25000 -Ethernet26 27,28 Ethernet7/3 7 25000 -Ethernet28 29,30 Ethernet8/1 8 25000 -Ethernet30 31,32 Ethernet8/3 8 25000 -Ethernet32 37,38 Ethernet9/1 9 25000 -Ethernet34 39,40 Ethernet9/3 9 25000 -Ethernet36 33,34 Ethernet10/1 10 25000 -Ethernet38 35,46 Ethernet10/3 10 25000 -Ethernet40 41,42 Ethernet11/1 11 25000 -Ethernet42 43,44 Ethernet11/3 11 25000 -Ethernet44 45,46 Ethernet12/1 12 25000 -Ethernet46 47,48 Ethernet12/3 12 25000 -Ethernet48 53,54 Ethernet13/1 13 25000 -Ethernet50 55,56 Ethernet13/3 13 25000 -Ethernet52 49,50 Ethernet14/1 14 25000 -Ethernet54 51,52 Ethernet14/3 14 25000 -Ethernet56 57,58 Ethernet15/1 15 25000 -Ethernet58 59,60 Ethernet15/3 15 25000 -Ethernet60 61,62 Ethernet16/1 16 25000 -Ethernet62 63,64 Ethernet16/3 16 25000 -Ethernet64 69,70 Ethernet17/1 17 25000 -Ethernet66 71,72 Ethernet17/3 17 25000 -Ethernet68 65,66 Ethernet18/1 18 25000 -Ethernet70 67,68 Ethernet18/3 18 25000 -Ethernet72 73,74 Ethernet19/1 19 25000 -Ethernet74 75,76 Ethernet19/3 19 25000 -Ethernet76 77,78 Ethernet20/1 20 25000 -Ethernet78 79,80 Ethernet20/3 20 25000 -Ethernet80 85,86 Ethernet21/1 21 25000 -Ethernet82 87,88 Ethernet21/3 21 25000 -Ethernet84 81,82 Ethernet22/1 22 25000 -Ethernet86 83,84 Ethernet22/3 22 25000 -Ethernet88 89,90 Ethernet23/1 23 25000 -Ethernet88 91,92 Ethernet23/3 23 25000 -Ethernet92 93,94 Ethernet24/1 24 25000 -Ethernet92 95,96 Ethernet24/3 24 25000 -Ethernet96 101,102,103,104 Ethernet25/1 25 100000 -Ethernet100 97,98,99,100 Ethernet26/1 26 100000 -Ethernet104 105,106,107,108 Ethernet27/1 27 100000 -Ethernet108 109,110,111,112 Ethernet28/1 28 100000 -Ethernet112 117,118,119,120 Ethernet29/1 29 100000 -Ethernet116 113,114,115,116 Ethernet30/1 30 100000 -Ethernet120 121,122,123,124 Ethernet31/1 31 100000 -Ethernet124 125,126,127,128 Ethernet32/1 32 100000 +Ethernet0 1 Ethernet1 1 25000 +Ethernet1 2 Ethernet2 2 25000 +Ethernet2 3 Ethernet3 3 25000 +Ethernet3 4 Ethernet4 4 25000 +Ethernet4 5 Ethernet5 5 25000 +Ethernet5 6 Ethernet6 6 25000 +Ethernet6 7 Ethernet7 7 25000 +Ethernet7 8 Ethernet8 8 25000 +Ethernet8 9 Ethernet9 9 25000 +Ethernet9 10 Ethernet10 10 25000 +Ethernet10 11 Ethernet11 11 25000 +Ethernet11 12 Ethernet12 12 25000 +Ethernet12 13 Ethernet13 13 25000 +Ethernet13 14 Ethernet14 14 25000 +Ethernet14 15 Ethernet15 15 25000 +Ethernet15 16 Ethernet16 16 25000 +Ethernet16 17 Ethernet17 17 25000 +Ethernet17 18 Ethernet18 18 25000 +Ethernet18 19 Ethernet19 19 25000 +Ethernet19 20 Ethernet20 20 25000 +Ethernet20 21 Ethernet21 21 25000 +Ethernet21 22 Ethernet22 22 25000 +Ethernet22 23 Ethernet23 23 25000 +Ethernet23 24 Ethernet24 24 25000 +Ethernet24 57 Ethernet25 25 25000 +Ethernet25 58 Ethernet26 26 25000 +Ethernet26 59 Ethernet27 27 25000 +Ethernet27 60 Ethernet28 28 25000 +Ethernet28 61 Ethernet29 29 25000 +Ethernet29 62 Ethernet30 30 25000 +Ethernet30 63 Ethernet31 31 25000 +Ethernet31 64 Ethernet32 32 25000 +Ethernet32 65 Ethernet33 33 25000 +Ethernet33 66 Ethernet34 34 25000 +Ethernet34 67 Ethernet35 35 25000 +Ethernet35 68 Ethernet36 36 25000 +Ethernet36 69 Ethernet37 37 25000 +Ethernet37 70 Ethernet38 38 25000 +Ethernet38 71 Ethernet39 39 25000 +Ethernet39 72 Ethernet40 40 25000 +Ethernet40 73 Ethernet41 41 25000 +Ethernet41 74 Ethernet42 42 25000 +Ethernet42 75 Ethernet43 43 25000 +Ethernet43 76 Ethernet44 44 25000 +Ethernet44 77 Ethernet45 45 25000 +Ethernet45 78 Ethernet46 46 25000 +Ethernet46 79 Ethernet47 47 25000 +Ethernet47 80 Ethernet48 48 25000 +Ethernet48 25,26,27,28 Ethernet49/1 49 100000 +Ethernet52 29,30,31,32 Ethernet50/1 50 100000 +Ethernet56 33,34,35,36 Ethernet51/1 51 100000 +Ethernet60 37,38,39,40 Ethernet52/1 52 100000 +Ethernet64 41,42,43,44 Ethernet53/1 53 100000 +Ethernet68 45,46,47,48 Ethernet54/1 54 100000 +Ethernet72 49,50,51,52 Ethernet55/1 55 100000 +Ethernet76 53,54,55,56 Ethernet56/1 56 100000 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 aa9b32d4a350..1ce55f79d95a 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 @@ -4,21 +4,25 @@ asf_mem_profile=2 bcm_num_cos=8 bcm_stat_flags=1 bcm_stat_jumbo=9236 +bcm_tunnel_term_compatible_mode=1 cdma_timeout_usec=15000000 +core_clock_frequency=1525 dma_desc_timeout_usec=15000000 +dpp_clock_ratio=2:3 fpem_mem_entries=0 higig2_hdr_mode=1 ifp_inports_support_enable=1 ipv6_lpm_128b_enable=0 l2xmsg_mode=1 l2_mem_entries=163840 +l3_alpm_enable=2 +l3_max_ecmp_mode=1 l3_mem_entries=147456 max_vp_lags=0 miim_intr_enable=0 module_64ports=1 multicast_l2_range=16383 multicast_l3_range=0 -num_ipv6_lpm_128b_entries=0 os=unix oversubscribe_mode=1 pbmp_xport_xe=0x1ffffffe1ffffffe @@ -302,10 +306,10 @@ portmap_21=21:25 portmap_22=22:25 portmap_23=23:25 portmap_24=24:25 -portmap_25=25:100:4 -portmap_26=29:100:4 -portmap_27=33:100:4 -portmap_28=37:100:4 +portmap_25=25:100 +portmap_26=29:100 +portmap_27=33:100 +portmap_28=37:100 portmap_33=57:25 portmap_34=58:25 portmap_35=59:25 @@ -330,10 +334,10 @@ portmap_53=77:25 portmap_54=78:25 portmap_55=79:25 portmap_56=80:25 -portmap_57=41:100:4 -portmap_58=45:100:4 -portmap_59=49:100:4 -portmap_60=53:100:4 +portmap_57=41:100 +portmap_58=45:100 +portmap_59=49:100 +portmap_60=53:100 port_flex_enable=1 port_init_autoneg_1=0 port_init_autoneg_5=0 @@ -420,3 +424,118 @@ serdes_core_tx_polarity_flip_physical{73}=0x0 serdes_core_tx_polarity_flip_physical{77}=0x0 tdma_timeout_usec=15000000 tslam_timeout_usec=15000000 +disable_pcie_firmware_check=1 + +# tuning +serdes_driver_current_1=0xf +serdes_driver_current_2=0xf +serdes_driver_current_3=0xf +serdes_driver_current_4=0xf +serdes_driver_current_5=0xf +serdes_driver_current_6=0xf +serdes_driver_current_7=0xf +serdes_driver_current_8=0xf +serdes_driver_current_9=0xf +serdes_driver_current_10=0xf +serdes_driver_current_11=0xf +serdes_driver_current_12=0xf +serdes_driver_current_13=0xf +serdes_driver_current_14=0xf +serdes_driver_current_15=0xf +serdes_driver_current_16=0xf +serdes_driver_current_17=0xf +serdes_driver_current_18=0xf +serdes_driver_current_19=0xf +serdes_driver_current_20=0xf +serdes_driver_current_21=0xf +serdes_driver_current_22=0xf +serdes_driver_current_23=0xf +serdes_driver_current_24=0xf +serdes_driver_current_25=0xf +serdes_driver_current_26=0xf +serdes_driver_current_27=0xf +serdes_driver_current_28=0xf +serdes_driver_current_33=0xf +serdes_driver_current_34=0xf +serdes_driver_current_35=0xf +serdes_driver_current_36=0xf +serdes_driver_current_37=0xf +serdes_driver_current_38=0xf +serdes_driver_current_39=0xf +serdes_driver_current_40=0xf +serdes_driver_current_41=0xf +serdes_driver_current_42=0xf +serdes_driver_current_43=0xf +serdes_driver_current_44=0xf +serdes_driver_current_45=0xf +serdes_driver_current_46=0xf +serdes_driver_current_47=0xf +serdes_driver_current_48=0xf +serdes_driver_current_49=0xf +serdes_driver_current_50=0xf +serdes_driver_current_51=0xf +serdes_driver_current_52=0xf +serdes_driver_current_53=0xf +serdes_driver_current_54=0xf +serdes_driver_current_55=0xf +serdes_driver_current_56=0xf +serdes_driver_current_57=0xf +serdes_driver_current_58=0xf +serdes_driver_current_59=0xf +serdes_driver_current_60=0xf +serdes_preemphasis_1=0x164105 +serdes_preemphasis_2=0x164105 +serdes_preemphasis_3=0x164105 +serdes_preemphasis_4=0x164105 +serdes_preemphasis_5=0x164105 +serdes_preemphasis_6=0x164105 +serdes_preemphasis_7=0x164105 +serdes_preemphasis_8=0x164105 +serdes_preemphasis_9=0x164105 +serdes_preemphasis_10=0x164105 +serdes_preemphasis_11=0x164105 +serdes_preemphasis_12=0x164105 +serdes_preemphasis_13=0x164105 +serdes_preemphasis_14=0x164105 +serdes_preemphasis_15=0x164105 +serdes_preemphasis_16=0x124105 +serdes_preemphasis_17=0x123f05 +serdes_preemphasis_18=0x123f05 +serdes_preemphasis_19=0x123f05 +serdes_preemphasis_20=0x123f05 +serdes_preemphasis_21=0x123f05 +serdes_preemphasis_22=0x123f05 +serdes_preemphasis_23=0x103c05 +serdes_preemphasis_24=0x103c05 +serdes_preemphasis_25=0x82e06 +serdes_preemphasis_26=0x92e05 +serdes_preemphasis_27=0x93006 +serdes_preemphasis_28=0x93006 +serdes_preemphasis_33=0x103c05 +serdes_preemphasis_34=0x103c05 +serdes_preemphasis_35=0x123f05 +serdes_preemphasis_36=0x123f05 +serdes_preemphasis_37=0x123f05 +serdes_preemphasis_38=0x123f05 +serdes_preemphasis_39=0x123f05 +serdes_preemphasis_40=0x123f05 +serdes_preemphasis_41=0x124105 +serdes_preemphasis_42=0x164105 +serdes_preemphasis_43=0x164105 +serdes_preemphasis_44=0x164105 +serdes_preemphasis_45=0x164105 +serdes_preemphasis_46=0x164105 +serdes_preemphasis_47=0x164105 +serdes_preemphasis_48=0x164105 +serdes_preemphasis_49=0x164105 +serdes_preemphasis_50=0x164105 +serdes_preemphasis_51=0x164105 +serdes_preemphasis_52=0x164105 +serdes_preemphasis_53=0x164105 +serdes_preemphasis_54=0x164105 +serdes_preemphasis_55=0x164105 +serdes_preemphasis_56=0x144105 +serdes_preemphasis_57=0x93006 +serdes_preemphasis_58=0x93006 +serdes_preemphasis_59=0x82d05 +serdes_preemphasis_60=0x82d05 diff --git a/device/arista/x86_64-arista_7050sx3_48yc8/pcie.yaml b/device/arista/x86_64-arista_7050sx3_48yc8/pcie.yaml new file mode 100644 index 000000000000..96e42dd936ef --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48yc8/pcie.yaml @@ -0,0 +1,163 @@ +- bus: '00' + dev: '00' + fn: '0' + id: '1576' + name: 'Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Processor Root Complex' +- bus: '00' + dev: '00' + fn: '2' + id: '1577' + name: 'IOMMU: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) I/O + Memory Management Unit' +- bus: '00' + dev: '02' + fn: '0' + id: 157b + name: 'Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Host Bridge' +- bus: '00' + dev: '02' + fn: '2' + id: 157c + name: 'PCI bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Processor Root Port' +- bus: '00' + dev: '02' + fn: '3' + id: 157c + name: 'PCI bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Processor Root Port' +- bus: '00' + dev: '02' + fn: '4' + id: 157c + name: 'PCI bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Processor Root Port' +- bus: '00' + dev: '02' + fn: '5' + id: 157c + name: 'PCI bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Processor Root Port' +- bus: '00' + dev: '03' + fn: '0' + id: 157b + name: 'Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Host Bridge' +- bus: '00' + dev: '03' + fn: '1' + id: 157c + name: 'PCI bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Processor Root Port' +- bus: '00' + dev: '03' + fn: '2' + id: 157c + name: 'PCI bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Processor Root Port' +- bus: '00' + dev: 08 + fn: '0' + id: '1578' + name: 'Encryption controller: Advanced Micro Devices, Inc. [AMD] Carrizo Platform + Security Processor' +- bus: '00' + dev: 09 + fn: '0' + id: '0001' + name: 'Host bridge: Arastra Inc. Device 0001' +- bus: '00' + dev: 09 + fn: '2' + id: 157a + name: 'Audio device: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Audio Controller' +- bus: '00' + dev: '10' + fn: '0' + id: '7914' + name: 'USB controller: Advanced Micro Devices, Inc. [AMD] FCH USB XHCI Controller + (rev 20)' +- bus: '00' + dev: '11' + fn: '0' + id: '7904' + name: 'SATA controller: Advanced Micro Devices, Inc. [AMD] FCH SATA Controller [AHCI + mode] (rev 49)' +- bus: '00' + dev: '12' + fn: '0' + id: '7908' + name: 'USB controller: Advanced Micro Devices, Inc. [AMD] FCH USB EHCI Controller + (rev 49)' +- bus: '00' + dev: '14' + fn: '0' + id: 790b + name: 'SMBus: Advanced Micro Devices, Inc. [AMD] FCH SMBus Controller (rev 4a)' +- bus: '00' + dev: '14' + fn: '3' + id: 790e + name: 'ISA bridge: Advanced Micro Devices, Inc. [AMD] FCH LPC Bridge (rev 11)' +- bus: '00' + dev: '14' + fn: '7' + id: '7906' + name: 'SD Host controller: Advanced Micro Devices, Inc. [AMD] FCH SD Flash Controller + (rev 01)' +- bus: '00' + dev: '18' + fn: '0' + id: '1570' + name: 'Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Processor Function 0' +- bus: '00' + dev: '18' + fn: '1' + id: '1571' + name: 'Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Processor Function 1' +- bus: '00' + dev: '18' + fn: '2' + id: '1572' + name: 'Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Processor Function 2' +- bus: '00' + dev: '18' + fn: '3' + id: '1573' + name: 'Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Processor Function 3' +- bus: '00' + dev: '18' + fn: '4' + id: '1574' + name: 'Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Processor Function 4' +- bus: '00' + dev: '18' + fn: '5' + id: '1575' + name: 'Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 60h-6fh) + Processor Function 5' +- bus: '01' + dev: '00' + fn: '0' + id: '1682' + name: 'Ethernet controller: Broadcom Limited NetXtreme BCM57762 Gigabit Ethernet + PCIe (rev 01)' +- bus: '02' + dev: '00' + fn: '0' + id: '0001' + name: 'System peripheral: Arastra Inc. Device 0001 (rev 01)' +- bus: '05' + dev: '00' + fn: '0' + id: b770 + name: 'Ethernet controller: Broadcom Limited Device b770 (rev 01)' diff --git a/device/arista/x86_64-arista_7050sx3_48yc8/sensors.conf b/device/arista/x86_64-arista_7050sx3_48yc8/sensors.conf index c6c60f294675..92cf81cf9311 100644 --- a/device/arista/x86_64-arista_7050sx3_48yc8/sensors.conf +++ b/device/arista/x86_64-arista_7050sx3_48yc8/sensors.conf @@ -2,25 +2,25 @@ # --------------------------------------------------- # -bus "i2c-8" "SCD 0000:02:00.0 SMBus master 0 bus 0" -bus "i2c-9" "SCD 0000:02:00.0 SMBus master 0 bus 1" -bus "i2c-10" "SCD 0000:02:00.0 SMBus master 0 bus 2" -bus "i2c-72" "SCD 0000:00:09.0 SMBus master 0 bus 2" +bus "i2c-9" "SCD 0000:02:00.0 SMBus master 0 bus 0" +bus "i2c-10" "SCD 0000:02:00.0 SMBus master 0 bus 1" +bus "i2c-11" "SCD 0000:02:00.0 SMBus master 0 bus 2" +bus "i2c-73" "SCD 0000:00:09.0 SMBus master 0 bus 2" chip "k10temp-pci-00c3" label temp1 "Cpu temp sensor" -chip "pmbus-i2c-8-58" +chip "pmbus-i2c-9-58" label temp1 "Power supply 1 hotspot sensor" label temp2 "Power supply 1 inlet temp sensor" label temp3 "Power supply 1 sensor" -chip "pmbus-i2c-9-58" +chip "pmbus-i2c-10-58" label temp1 "Power supply 2 hotspot sensor" label temp2 "Power supply 2 inlet temp sensor" label temp3 "Power supply 2 sensor" -chip "max6658-i2c-72-4c" +chip "max6658-i2c-73-4c" label temp1 "Board temp sensor" set temp1_max 75 set temp1_crit 85 @@ -29,7 +29,7 @@ chip "max6658-i2c-72-4c" set temp2_max 75 set temp2_crit 85 -chip "tmp464-i2c-10-48" +chip "tmp464-i2c-11-48" label temp1 "Switch Card temp sensor" set temp1_max 100 set temp1_crit 110 diff --git a/device/arista/x86_64-arista_7060dx4_32/pcie.yaml b/device/arista/x86_64-arista_7060dx4_32/pcie.yaml new file mode 100644 index 000000000000..9417788f1dbd --- /dev/null +++ b/device/arista/x86_64-arista_7060dx4_32/pcie.yaml @@ -0,0 +1,433 @@ +- 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: 1a + fn: '0' + id: 8c2d + name: 'USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB + EHCI #2 (rev 05)' +- bus: '00' + dev: 1c + fn: '0' + id: 8c10 + name: 'PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express + Root Port #1 (rev d5)' +- bus: '00' + dev: 1c + fn: '4' + id: 8c18 + name: 'PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express + Root Port #5 (rev d5)' +- 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: '01' + dev: '00' + fn: '0' + id: '1682' + name: 'Ethernet controller: Broadcom Limited NetXtreme BCM57762 Gigabit Ethernet + PCIe (rev 20)' +- bus: '02' + dev: '00' + fn: '0' + id: '1682' + name: 'Ethernet controller: Broadcom Limited NetXtreme BCM57762 Gigabit Ethernet + PCIe (rev 20)' +- 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: 15a7 + name: 'Ethernet controller: Intel Corporation Device 15a7' +- bus: '04' + dev: '00' + fn: '1' + id: 15a7 + name: 'Ethernet controller: Intel Corporation Device 15a7' +- bus: '06' + dev: '00' + fn: '0' + id: b980 + name: 'Ethernet controller: Broadcom Limited Device b980 (rev 11)' +- bus: '07' + dev: '00' + fn: '0' + id: '0001' + name: 'System peripheral: Arastra Inc. Device 0001 (rev 01)' +- 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: '0001' + name: 'System peripheral: Arastra Inc. Device 0001 (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: 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/arista/x86_64-arista_7060px4_32/pcie.yaml b/device/arista/x86_64-arista_7060px4_32/pcie.yaml new file mode 100644 index 000000000000..9417788f1dbd --- /dev/null +++ b/device/arista/x86_64-arista_7060px4_32/pcie.yaml @@ -0,0 +1,433 @@ +- 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: 1a + fn: '0' + id: 8c2d + name: 'USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB + EHCI #2 (rev 05)' +- bus: '00' + dev: 1c + fn: '0' + id: 8c10 + name: 'PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express + Root Port #1 (rev d5)' +- bus: '00' + dev: 1c + fn: '4' + id: 8c18 + name: 'PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express + Root Port #5 (rev d5)' +- 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: '01' + dev: '00' + fn: '0' + id: '1682' + name: 'Ethernet controller: Broadcom Limited NetXtreme BCM57762 Gigabit Ethernet + PCIe (rev 20)' +- bus: '02' + dev: '00' + fn: '0' + id: '1682' + name: 'Ethernet controller: Broadcom Limited NetXtreme BCM57762 Gigabit Ethernet + PCIe (rev 20)' +- 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: 15a7 + name: 'Ethernet controller: Intel Corporation Device 15a7' +- bus: '04' + dev: '00' + fn: '1' + id: 15a7 + name: 'Ethernet controller: Intel Corporation Device 15a7' +- bus: '06' + dev: '00' + fn: '0' + id: b980 + name: 'Ethernet controller: Broadcom Limited Device b980 (rev 11)' +- bus: '07' + dev: '00' + fn: '0' + id: '0001' + name: 'System peripheral: Arastra Inc. Device 0001 (rev 01)' +- 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: '0001' + name: 'System peripheral: Arastra Inc. Device 0001 (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: 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/arista/x86_64-arista_7170_64c/pcie.yaml b/device/arista/x86_64-arista_7170_64c/pcie.yaml new file mode 100644 index 000000000000..f26914761125 --- /dev/null +++ b/device/arista/x86_64-arista_7170_64c/pcie.yaml @@ -0,0 +1,421 @@ +- 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: 1c + fn: '0' + id: 8c10 + name: 'PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express + Root Port #1 (rev d5)' +- bus: '00' + dev: 1c + fn: '4' + id: 8c18 + name: 'PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express + Root Port #5 (rev d5)' +- 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: '01' + dev: '00' + fn: '0' + id: '1682' + name: 'Ethernet controller: Broadcom Limited NetXtreme BCM57762 Gigabit Ethernet + PCIe (rev 20)' +- bus: '02' + dev: '00' + fn: '0' + id: '1682' + name: 'Ethernet controller: Broadcom Limited NetXtreme BCM57762 Gigabit Ethernet + PCIe (rev 20)' +- 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: 15ab + name: 'Ethernet controller: Intel Corporation Ethernet Connection X552 10 GbE Backplane' +- bus: '04' + dev: '00' + fn: '1' + id: 15ab + name: 'Ethernet controller: Intel Corporation Ethernet Connection X552 10 GbE Backplane' +- bus: '06' + dev: '00' + fn: '0' + id: '0001' + name: 'System peripheral: Arastra Inc. Device 0001' +- bus: '07' + 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: '0001' + name: 'System peripheral: Arastra Inc. Device 0001 (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: 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/arista/x86_64-arista_7280cr3_32p4/Arista-7280CR3-C32P4/sai.profile b/device/arista/x86_64-arista_7280cr3_32p4/Arista-7280CR3-C32P4/sai.profile new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/device/arista/x86_64-arista_7280cr3_32p4/sensors.conf b/device/arista/x86_64-arista_7280cr3_32p4/sensors.conf index 2a80dbd612ac..9fea0d6b40f1 100644 --- a/device/arista/x86_64-arista_7280cr3_32p4/sensors.conf +++ b/device/arista/x86_64-arista_7280cr3_32p4/sensors.conf @@ -1,12 +1,12 @@ # libsensors configuration file for DCS-7280CR3-32P4 # ------------------------------------------------# -bus "i2c-8" "SCD 0000:02:00.0 SMBus master 0 bus 0" -bus "i2c-14" "SCD 0000:02:00.0 SMBus master 0 bus 6" -bus "i2c-15" "SCD 0000:02:00.0 SMBus master 0 bus 7" -bus "i2c-56" "SCD 0000:00:09.0 SMBus master 0 bus 0" +bus "i2c-9" "SCD 0000:02:00.0 SMBus master 0 bus 0" +bus "i2c-15" "SCD 0000:02:00.0 SMBus master 0 bus 6" +bus "i2c-16" "SCD 0000:02:00.0 SMBus master 0 bus 7" +bus "i2c-57" "SCD 0000:00:09.0 SMBus master 0 bus 0" -chip "tmp468-i2c-8-48" +chip "tmp468-i2c-9-48" label temp1 "Board sensor" label temp2 "Front air (inlet) sensor" label temp3 "Rear air sensor" @@ -32,7 +32,7 @@ chip "tmp468-i2c-8-48" set temp9_max 100 set temp9_crit 110 -chip "pmbus-i2c-14-58" +chip "pmbus-i2c-15-58" label temp1 "Power supply 1 hotspot sensor" label temp2 "Power supply 1 inlet temp sensor" label temp3 "Power supply 1 exhaust temp sensor" @@ -44,7 +44,7 @@ chip "pmbus-i2c-14-58" ignore fan3 ignore fan4 -chip "pmbus-i2c-15-58" +chip "pmbus-i2c-16-58" label temp1 "Power supply 2 hotspot sensor" label temp2 "Power supply 2 inlet temp sensor" label temp3 "Power supply 2 exhaust temp sensor" @@ -56,7 +56,7 @@ chip "pmbus-i2c-15-58" ignore fan3 ignore fan4 -chip "max6658-i2c-56-4c" +chip "max6658-i2c-57-4c" label temp1 "Back panel temp sensor 1" label temp2 "Back panel temp sensor 2" diff --git a/platform/barefoot/sonic-platform-modules-arista b/platform/barefoot/sonic-platform-modules-arista index 7ba49d06b2b6..5c26cc044bc0 160000 --- a/platform/barefoot/sonic-platform-modules-arista +++ b/platform/barefoot/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 7ba49d06b2b6d3c951b4e41881e9a15ed406eca9 +Subproject commit 5c26cc044bc0a218c5572c5a36450df4c4f436d8 diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index 7ba49d06b2b6..5c26cc044bc0 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 7ba49d06b2b6d3c951b4e41881e9a15ed406eca9 +Subproject commit 5c26cc044bc0a218c5572c5a36450df4c4f436d8 diff --git a/rules/docker-platform-monitor.mk b/rules/docker-platform-monitor.mk index 365b474ed93a..4cb3299ca21e 100644 --- a/rules/docker-platform-monitor.mk +++ b/rules/docker-platform-monitor.mk @@ -61,6 +61,7 @@ $(DOCKER_PLATFORM_MONITOR)_RUN_OPT += -v /var/run/platform_cache:/var/run/platfo $(DOCKER_PLATFORM_MONITOR)_RUN_OPT += -v /usr/share/sonic/device/pddf:/usr/share/sonic/device/pddf:ro # 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 From 6e264d8ac9bca89eec469af3b5b5f3398d2fb59f Mon Sep 17 00:00:00 2001 From: Nazarii Hnydyn Date: Thu, 6 May 2021 22:14:21 +0300 Subject: [PATCH 029/136] [swss_vars]: Add 'resource_type' attribute. (#7526) Signed-off-by: Nazarii Hnydyn --- files/build_templates/swss_vars.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/files/build_templates/swss_vars.j2 b/files/build_templates/swss_vars.j2 index a9bd01565c89..df5e4d038f51 100644 --- a/files/build_templates/swss_vars.j2 +++ b/files/build_templates/swss_vars.j2 @@ -2,5 +2,6 @@ "asic_type": "{{ asic_type }}", "asic_id": "{{ DEVICE_METADATA.localhost.asic_id }}", "mac": "{{ DEVICE_METADATA.localhost.mac }}", + "resource_type": "{{ DEVICE_METADATA.localhost.resource_type }}", "synchronous_mode": {% if DEVICE_METADATA.localhost.synchronous_mode == "disable" %}"disable"{% else %}"enable"{% endif %} } From 06377f0f9abab1244c879656f72da9cb71227f8c Mon Sep 17 00:00:00 2001 From: Sudharsan Dhamal Gopalarathnam Date: Thu, 6 May 2021 13:31:33 -0700 Subject: [PATCH 030/136] sonic-utilities submodule update (#7532) 9a88cb6 [sonic_installer] dont fail package migration (#1591) 615e531 [show][config] Add new snmp commands (#1347) fff4051 Fixing serial number read to get from DB if it is populated (#1580) be974bf [neighbor_advertiser] Use existing tunnel if present for creating tunnel mappings (#1589) 9492eab Use swsscommon instead of swsssdk (#1510) 0f4988b Add pg-drop script to sonic filesystem (#1583) cbe2159 [vnet] Add "vnet_route_check" script (#1300) 9120766 Relax the install_requires, no need to exact version as long as there are no broken changes with future versions (#1530) 2e09b22 Handle the new db version which mellanox_buffer_migrator isn't interested (#1566) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 08337aa7637b..9a88cb6f0fba 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 08337aa7637b290bb8407c38b2a5dbe3e8383b3e +Subproject commit 9a88cb6f0fbaf5fc8c336723cc7b831c6aacf19b From 8ceec5c84318245f44af4fe6016f3b353d26e6a2 Mon Sep 17 00:00:00 2001 From: pettershao-ragilenetworks <81281940+pettershao-ragilenetworks@users.noreply.github.com> Date: Fri, 7 May 2021 05:53:20 +0800 Subject: [PATCH 031/136] [ruijie] Fix show version error info (#7541) Fix following crash in `show version`: ``` Traceback (most recent call last): File "/usr/local/bin/decode-syseeprom", line 32, in instantiate_eeprom_object eeprom = sonic_platform.platform.Platform().get_chassis().get_eeprom() AttributeError: module 'sonic_platform' has no attribute 'platform' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/bin/decode-syseeprom", line 262, in sys.exit(main()) File "/usr/local/bin/decode-syseeprom", line 244, in main print_serial(use_db) File "/usr/local/bin/decode-syseeprom", line 169, in print_serial eeprom = instantiate_eeprom_object() File "/usr/local/bin/decode-syseeprom", line 34, in instantiate_eeprom_object log.log_error('Failed to obtain EEPROM object due to {}'.format(repr(e))) NameError: name 'log' is not defined ``` Signed-off-by: pettershao-ragilenetworks --- .../b6510-48vs8cq/sonic_platform/__init__.py | 1 + .../broadcom/sonic-platform-modules-ruijie/common/Makefile | 4 ++++ .../common/depmod_conf/distsearch.conf | 4 ++++ 3 files changed, 9 insertions(+) create mode 100644 platform/broadcom/sonic-platform-modules-ruijie/common/depmod_conf/distsearch.conf diff --git a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/__init__.py b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/__init__.py index f6c1757b8374..a94378b209dc 100644 --- a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/__init__.py +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/__init__.py @@ -1 +1,2 @@ __all__ = ["platform", "chassis", "fan", "psu", "sfp", "thermal", "common"] +from sonic_platform import platform diff --git a/platform/broadcom/sonic-platform-modules-ruijie/common/Makefile b/platform/broadcom/sonic-platform-modules-ruijie/common/Makefile index 205a32578e2a..0b74b4865b52 100755 --- a/platform/broadcom/sonic-platform-modules-ruijie/common/Makefile +++ b/platform/broadcom/sonic-platform-modules-ruijie/common/Makefile @@ -9,6 +9,7 @@ SUB_BUILD_DIR = $(PWD)/build DIR_KERNEL_SRC = $(PWD)/modules SCRIPT_DIR = $(PWD)/script SERVICE_DIR = $(PWD)/service +DEPMOD_CONF_DIR = $(PWD)/depmod_conf KBUILD_EXTRA_SYMBOLS += $(DIR_KERNEL_SRC)/Module.symvers export KBUILD_EXTRA_SYMBOLS @@ -17,6 +18,7 @@ INSTALL_MODULE_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 INSTALL_LIB_DIR = $(SUB_BUILD_DIR)/usr/lib/python3.7/dist-packages +INSTALL_DEPMOD_CONF = $(SUB_BUILD_DIR)/etc/depmod.d all: $(MAKE) -C $(KERNEL_SRC)/build M=$(DIR_KERNEL_SRC) modules @@ -27,6 +29,8 @@ all: @if [ -d $(PWD)/lib/ ]; then cp -r $(PWD)/lib/* ${INSTALL_LIB_DIR} ;fi @if [ -d $(PWD)/lib/ ]; then cp -r $(PWD)/lib/* ${INSTALL_LIB_DIR2} ;fi cp -r $(DIR_KERNEL_SRC)/*.ko $(INSTALL_MODULE_DIR) + @if [ ! -d ${INSTALL_DEPMOD_CONF} ]; then mkdir -p ${INSTALL_DEPMOD_CONF} ;fi + cp -r $(DEPMOD_CONF_DIR)/* $(INSTALL_DEPMOD_CONF) cp -r $(SCRIPT_DIR)/* $(INSTALL_SCRIPT_DIR) cp -r $(SERVICE_DIR)/* $(INSTALL_SERVICE_DIR) @if [ -d $(INSTALL_SCRIPT_DIR) ]; then chmod +x $(INSTALL_SCRIPT_DIR)/* ;fi diff --git a/platform/broadcom/sonic-platform-modules-ruijie/common/depmod_conf/distsearch.conf b/platform/broadcom/sonic-platform-modules-ruijie/common/depmod_conf/distsearch.conf new file mode 100644 index 000000000000..ad60b2eb6f95 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ruijie/common/depmod_conf/distsearch.conf @@ -0,0 +1,4 @@ +# depmod.conf +# +# override default search ordering for kmod packaging +search updates extra external built-in weak-updates From 43995ab270c1403cc420520a7a9381b258536a2c Mon Sep 17 00:00:00 2001 From: Kamil Cudnik Date: Fri, 7 May 2021 07:10:41 +0200 Subject: [PATCH 032/136] [sonic-slave]: Disable aspell on armhf (#7550) Read more here: https://bugs.launchpad.net/qemu/+bug/1805913 --- sonic-slave-buster/Dockerfile.j2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sonic-slave-buster/Dockerfile.j2 b/sonic-slave-buster/Dockerfile.j2 index e5f35f78f535..316007c4041e 100644 --- a/sonic-slave-buster/Dockerfile.j2 +++ b/sonic-slave-buster/Dockerfile.j2 @@ -366,6 +366,9 @@ RUN apt-get update && apt-get install -y \ # Aspell is unable to locate the language dictionaries. # Re-installing aspell-en dictionary to fix it. RUN apt-get install --reinstall -y aspell-en + + # workaround because of https://bugs.launchpad.net/qemu/+bug/1805913, just disable aspell + RUN cp /bin/true /usr/bin/aspell {%- endif %} ## Config dpkg From db3d353e77a33081b2e49b182275f65810ef39c0 Mon Sep 17 00:00:00 2001 From: VenkatCisco <77468614+VenkatCisco@users.noreply.github.com> Date: Thu, 6 May 2021 22:24:07 -0700 Subject: [PATCH 033/136] [pmon]: add psmisc to bring fuser that dentifies processes that are using files or sockets (#7509) fuser support is required since new cisco hardware watchdog plugin uses them to check anyone else use's /dev/watchdogX resource. The actual validation happens in the platform code, but the package is required for pmon container. Currently the /dev/watchdogX is being used by cisco platform-monitor service. Cisco chassis level watchdog plugin uses "fuser" to claim the watchdog release from platform-monitor service. --- dockers/docker-platform-monitor/Dockerfile.j2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 index 7e8d75680fa8..482b5ccd9b25 100755 --- a/dockers/docker-platform-monitor/Dockerfile.j2 +++ b/dockers/docker-platform-monitor/Dockerfile.j2 @@ -23,7 +23,8 @@ RUN apt-get update && \ python-smbus \ python3-smbus \ dmidecode \ - i2c-tools + i2c-tools \ + psmisc # TODO: Remove these lines once we no longer need Python 2 RUN apt-get install -f -y python-dev python-pip From dee7d8f9ca333522f6b87ee32e48b6137762e6f6 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 7 May 2021 01:51:44 -0700 Subject: [PATCH 034/136] [sonic-utilities] submodule update (#7546) Includes below commits 9a88cb6 2021-05-06 | [sonic_installer] dont fail package migration (#1591) [Stepan Blyshchak] 615e531 2021-05-05 | [show][config] Add new snmp commands (#1347) [Travis Van Duyn] fff4051 2021-05-05 | Fixing serial number read to get from DB if it is populated (#1580) [Sudharsan Dhamal Gopalarathnam] be974bf 2021-05-05 | [neighbor_advertiser] Use existing tunnel if present for creating tunnel mappings (#1589) [Sumukha Tumkur Vani] 9492eab 2021-05-04 | Use swsscommon instead of swsssdk (#1510) [Andriy Yurkiv] 0f4988b 2021-05-04 | Add pg-drop script to sonic filesystem (#1583) [Andriy Yurkiv] cbe2159 2021-05-04 | [vnet] Add "vnet_route_check" script (#1300) [Volodymyr Samotiy] 9120766 2021-05-03 | Relax the install_requires, no need to exact version as long as there are no broken changes with future versions (#1530) [Qi Luo] 2e09b22 2021-05-03 | Handle the new db version which mellanox_buffer_migrator isn't interested (#1566) [Stephen Sun] From 9daec6f20b7108cce9e84a15e8c086bc3a776e94 Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Fri, 7 May 2021 16:52:18 +0800 Subject: [PATCH 035/136] [build]: Fix build wrapper commands not cleanup issue (#7553) cleanup the build commands after build finished. --- build_debian.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build_debian.sh b/build_debian.sh index 413c2f8a9205..c3e8e945443c 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -578,9 +578,8 @@ sudo rm -f $ONIE_INSTALLER_PAYLOAD $FILESYSTEM_SQUASHFS ## Note: -x to skip directories on different file systems, such as /proc sudo du -hsx $FILESYSTEM_ROOT sudo mkdir -p $FILESYSTEM_ROOT/var/lib/docker -sudo mksquashfs $FILESYSTEM_ROOT $FILESYSTEM_SQUASHFS -e boot -e var/lib/docker -e $PLATFORM_DIR - scripts/collect_host_image_version_files.sh $TARGET_PATH $FILESYSTEM_ROOT +sudo mksquashfs $FILESYSTEM_ROOT $FILESYSTEM_SQUASHFS -e boot -e var/lib/docker -e $PLATFORM_DIR # Ensure admin gid is 1000 gid_user=$(sudo LANG=C chroot $FILESYSTEM_ROOT id -g $USERNAME) || gid_user="none" From 3dddbf22faef7e6e2ef7b15ade78044f042b9747 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 7 May 2021 01:55:40 -0700 Subject: [PATCH 036/136] [brcm] Fix and simplify start_led.sh (#7548) LED_PROC_INIT_SOC variable was incorrectly referenced as LED_SOC_INIT_SOC. Introduced in #5483 Rather than fixing the typo, I decided to simplify the script, removing the need for the conditional altogether by moving the bcmcmd call inside the conditional which checks for the presence of LED_SOC_INIT_SOC. --- platform/broadcom/docker-syncd-brcm/start_led.sh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/platform/broadcom/docker-syncd-brcm/start_led.sh b/platform/broadcom/docker-syncd-brcm/start_led.sh index 964aa23eb04f..0b133d6d811e 100755 --- a/platform/broadcom/docker-syncd-brcm/start_led.sh +++ b/platform/broadcom/docker-syncd-brcm/start_led.sh @@ -4,11 +4,6 @@ PLATFORM_DIR=/usr/share/sonic/platform SYNCD_SOCKET_FILE=/var/run/sswsyncd/sswsyncd.socket LED_PROC_INIT_SOC=${PLATFORM_DIR}/led_proc_init.soc -if [ ! -f "$LED_PROC_INIT_SOC" ]; then - echo "No soc led configuration found under $LED_SOC_INIT_SOC" - exit 0 -fi - # Function: wait until syncd has created the socket for bcmcmd to connect to wait_syncd() { while true; do @@ -38,6 +33,6 @@ wait_syncd() { # If this platform has an initialization file for the Broadcom LED microprocessor, load it if [[ -r "$LED_PROC_INIT_SOC" && ! -f /var/warmboot/warm-starting ]]; then wait_syncd + /usr/bin/bcmcmd -t 60 "rcload $LED_PROC_INIT_SOC" fi -/usr/bin/bcmcmd -t 60 "rcload $LED_PROC_INIT_SOC" From 7a575b3d0040cafca84be35ff62059a2ea9099b3 Mon Sep 17 00:00:00 2001 From: Renuka Manavalan <47282725+renukamanavalan@users.noreply.github.com> Date: Fri, 7 May 2021 08:42:15 -0700 Subject: [PATCH 037/136] [container_checker] Use Feature table to get running containers (#7474) Why I did it Finding running containers through "docker ps" breaks when kubernetes deploys container, as the names are mangled. How I did it The data is is available from FEATURE table, which takes care of kubernetes deployment too. How to verify it Deploy a feature via kubernetes and don't expect error from container_check. --- files/image_config/monit/container_checker | 112 ++++++++++++++------- 1 file changed, 76 insertions(+), 36 deletions(-) diff --git a/files/image_config/monit/container_checker b/files/image_config/monit/container_checker index 88c288fccd65..2a000d1e6bb7 100755 --- a/files/image_config/monit/container_checker +++ b/files/image_config/monit/container_checker @@ -16,50 +16,31 @@ check program container_checker with path "/usr/bin/container_checker" if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles """ -import subprocess +import docker import sys import swsssdk from sonic_py_common import multi_asic - - -def get_command_result(command): - """ - @summary: This function will execute the command and return the resulting output. - @return: A string which contains the output of command. - """ - command_stdout = "" - - try: - proc_instance = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, - shell=True, universal_newlines=True) - command_stdout, command_stderr = proc_instance.communicate() - if proc_instance.returncode != 0: - print("Failed to execute the command '{}'. Return code: '{}'".format( - command, proc_instance.returncode)) - sys.exit(1) - except (OSError, ValueError) as err: - print("Failed to execute the command '{}'. Error: '{}'".format(command, err)) - sys.exit(2) - - return command_stdout.rstrip().split("\n") +from swsscommon import swsscommon def get_expected_running_containers(): """ - @summary: This function will get the expected running containers by following the rule: + @summary: This function will get the expected running & always-enabled containers by following the rule: The 'state' field of container in 'FEATURE' table should not be 'disabled' or 'always_disabled'. If the device has Multi-ASIC, this function will get container list by determining the 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. + @return: A set which contains the expected running containers and a set that has + containers marked as "always_enabled". """ config_db = swsssdk.ConfigDBConnector() config_db.connect() feature_table = config_db.get_table("FEATURE") 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"]: @@ -70,37 +51,95 @@ 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) - return expected_running_containers + return expected_running_containers, always_running_containers -def get_current_running_containers(): +def get_current_running_from_DB(always_running_containers): """ - @summary: This function will get the current running container list by analyzing the - output of command `docker ps`. - @return: A set which contains the current running contianers. + @summary: This function will get the current running container list + from FEATURE table @ STATE_DB, if this table is available. + @return: a tuple + First: Return value indicating if info can be obtained from + DB or not. + Second: A set which contains the current running containers, + if this info is available in DB. """ running_containers = set() - command = "docker ps" - command_stdout = get_command_result(command) - for line in command_stdout[1:]: - running_containers.add(line.split()[-1].strip()) + state_db = swsscommon.DBConnector("STATE_DB", 0) + tbl = swsscommon.Table(state_db, "FEATURE") + if not tbl.getKeys(): + return False, None + + for name in tbl.getKeys(): + data = dict(tbl.get(name)[1]) + if data.get('container_id'): + running_containers.add(name) + + DOCKER_CLIENT = docker.DockerClient(base_url='unix://var/run/docker.sock') + RUNNING = 'running' + for name in always_running_containers: + try: + container = DOCKER_CLIENT.containers.get(name) + container_state = container.attrs.get('State', {}) + if container_state.get('Status', "") == RUNNING: + running_containers.add(name) + except (docker.errors.NotFound, docker.errors.APIError) as err: + print("Failed to get container '{}'. Error: '{}'".format(name, err)) + pass + + return True, running_containers + +def get_current_running_from_dockers(): + """ + @summary: This function will get all running containers from + the list of docker containers in running state. + @return: A set which contains containers that are + in running state. + """ + 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) + except docker.errors.APIError as err: + print("Failed to retrieve the running container list. Error: '{}'".format(err)) + pass return running_containers +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() + return current_running_containers + + def main(): """ @summary: This function will compare the difference between the current running containers and the containers which were expected to run. If containers which were exepcted to run were not running, then an alerting message will be written into syslog. """ - expected_running_containers = get_expected_running_containers() - current_running_containers = get_current_running_containers() + expected_running_containers, always_running_containers = get_expected_running_containers() + current_running_containers = get_current_running_containers(always_running_containers) + expected_running_containers |= always_running_containers not_running_containers = expected_running_containers.difference(current_running_containers) if not_running_containers: print("Expected containers not running: " + ", ".join(not_running_containers)) @@ -114,3 +153,4 @@ def main(): if __name__ == "__main__": main() + sys.exit(0) From 629f4459d79d16d8a2b30d95f1c94b8982977d61 Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Sat, 8 May 2021 00:42:40 +0800 Subject: [PATCH 038/136] [Mellanox] Align PSU fan name in platform.json with latest change in PR #7490 (#7557) The PSU fan name convention was changed from "psu_{}_fan_{}" to "psu{}_fan{}" in PR #7490, platform.json need to be changed and aligned. --- device/mellanox/x86_64-mlnx_msn2410-r0/platform.json | 4 ++-- device/mellanox/x86_64-mlnx_msn2700-r0/platform.json | 4 ++-- device/mellanox/x86_64-mlnx_msn2740-r0/platform.json | 4 ++-- device/mellanox/x86_64-mlnx_msn3420-r0/platform.json | 4 ++-- device/mellanox/x86_64-mlnx_msn3700-r0/platform.json | 4 ++-- device/mellanox/x86_64-mlnx_msn3700c-r0/platform.json | 4 ++-- device/mellanox/x86_64-mlnx_msn3800-r0/platform.json | 4 ++-- device/mellanox/x86_64-mlnx_msn4410-r0/platform.json | 4 ++-- device/mellanox/x86_64-mlnx_msn4600-r0/platform.json | 4 ++-- device/mellanox/x86_64-mlnx_msn4600c-r0/platform.json | 4 ++-- device/mellanox/x86_64-mlnx_msn4700-r0/platform.json | 4 ++-- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/platform.json b/device/mellanox/x86_64-mlnx_msn2410-r0/platform.json index f0e6f6f320ad..10ac34581492 100644 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/platform.json @@ -73,7 +73,7 @@ "name": "PSU 1", "fans": [ { - "name": "psu_1_fan_1" + "name": "psu1_fan1" } ], "thermals": [ @@ -86,7 +86,7 @@ "name": "PSU 2", "fans": [ { - "name": "psu_2_fan_1" + "name": "psu2_fan1" } ], "thermals": [ diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/platform.json b/device/mellanox/x86_64-mlnx_msn2700-r0/platform.json index 4cf282b46cf9..09445f7fe9b8 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/platform.json @@ -73,7 +73,7 @@ "name": "PSU 1", "fans": [ { - "name": "psu_1_fan_1" + "name": "psu1_fan1" } ], "thermals": [ @@ -86,7 +86,7 @@ "name": "PSU 2", "fans": [ { - "name": "psu_2_fan_1" + "name": "psu2_fan1" } ], "thermals": [ diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/platform.json b/device/mellanox/x86_64-mlnx_msn2740-r0/platform.json index 33821ad83bd9..e7847ee28582 100644 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/platform.json @@ -58,7 +58,7 @@ "name": "PSU 1", "fans": [ { - "name": "psu_1_fan_1" + "name": "psu1_fan1" } ], "thermals": [ @@ -71,7 +71,7 @@ "name": "PSU 2", "fans": [ { - "name": "psu_2_fan_1" + "name": "psu2_fan1" } ], "thermals": [ diff --git a/device/mellanox/x86_64-mlnx_msn3420-r0/platform.json b/device/mellanox/x86_64-mlnx_msn3420-r0/platform.json index 339e40e79fd4..415d7de70ebb 100644 --- a/device/mellanox/x86_64-mlnx_msn3420-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn3420-r0/platform.json @@ -84,7 +84,7 @@ "name": "PSU 1", "fans": [ { - "name": "psu_1_fan_1" + "name": "psu1_fan1" } ], "thermals": [ @@ -97,7 +97,7 @@ "name": "PSU 2", "fans": [ { - "name": "psu_2_fan_1" + "name": "psu2_fan1" } ], "thermals": [ diff --git a/device/mellanox/x86_64-mlnx_msn3700-r0/platform.json b/device/mellanox/x86_64-mlnx_msn3700-r0/platform.json index 36ee7fac87c5..ffb0d93cd37c 100644 --- a/device/mellanox/x86_64-mlnx_msn3700-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn3700-r0/platform.json @@ -95,7 +95,7 @@ "name": "PSU 1", "fans": [ { - "name": "psu_1_fan_1" + "name": "psu1_fan1" } ], "thermals": [ @@ -108,7 +108,7 @@ "name": "PSU 2", "fans": [ { - "name": "psu_2_fan_1" + "name": "psu2_fan1" } ], "thermals": [ diff --git a/device/mellanox/x86_64-mlnx_msn3700c-r0/platform.json b/device/mellanox/x86_64-mlnx_msn3700c-r0/platform.json index 9b62165447e0..821b8204e730 100644 --- a/device/mellanox/x86_64-mlnx_msn3700c-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn3700c-r0/platform.json @@ -73,7 +73,7 @@ "name": "PSU 1", "fans": [ { - "name": "psu_1_fan_1" + "name": "psu1_fan1" } ], "thermals": [ @@ -86,7 +86,7 @@ "name": "PSU 2", "fans": [ { - "name": "psu_2_fan_1" + "name": "psu2_fan1" } ], "thermals": [ diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/platform.json b/device/mellanox/x86_64-mlnx_msn3800-r0/platform.json index ed6122236663..3c458e4e1cea 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/platform.json @@ -56,7 +56,7 @@ "name": "PSU 1", "fans": [ { - "name": "psu_1_fan_1" + "name": "psu1_fan1" } ], "thermals": [ @@ -69,7 +69,7 @@ "name": "PSU 2", "fans": [ { - "name": "psu_2_fan_1" + "name": "psu2_fan1" } ], "thermals": [ diff --git a/device/mellanox/x86_64-mlnx_msn4410-r0/platform.json b/device/mellanox/x86_64-mlnx_msn4410-r0/platform.json index d50fc6f5c6de..c4836d4b2359 100644 --- a/device/mellanox/x86_64-mlnx_msn4410-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn4410-r0/platform.json @@ -95,7 +95,7 @@ "name": "PSU 1", "fans": [ { - "name": "psu_1_fan_1" + "name": "psu1_fan1" } ], "thermals": [ @@ -108,7 +108,7 @@ "name": "PSU 2", "fans": [ { - "name": "psu_2_fan_1" + "name": "psu2_fan1" } ], "thermals": [ diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/platform.json b/device/mellanox/x86_64-mlnx_msn4600-r0/platform.json index 9794c0d94a18..033b58cb81af 100644 --- a/device/mellanox/x86_64-mlnx_msn4600-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/platform.json @@ -53,7 +53,7 @@ "name": "PSU 1", "fans": [ { - "name": "psu_1_fan_1" + "name": "psu1_fan1" } ], "thermals": [ @@ -66,7 +66,7 @@ "name": "PSU 2", "fans": [ { - "name": "psu_2_fan_1" + "name": "psu2_fan1" } ], "thermals": [ diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/platform.json b/device/mellanox/x86_64-mlnx_msn4600c-r0/platform.json index 37decda69d6b..691be91ab49b 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/platform.json @@ -53,7 +53,7 @@ "name": "PSU 1", "fans": [ { - "name": "psu_1_fan_1" + "name": "psu1_fan1" } ], "thermals": [ @@ -66,7 +66,7 @@ "name": "PSU 2", "fans": [ { - "name": "psu_2_fan_1" + "name": "psu2_fan1" } ], "thermals": [ diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/platform.json b/device/mellanox/x86_64-mlnx_msn4700-r0/platform.json index a9c1c5dd0584..9f0391fa35ec 100644 --- a/device/mellanox/x86_64-mlnx_msn4700-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/platform.json @@ -95,7 +95,7 @@ "name": "PSU 1", "fans": [ { - "name": "psu_1_fan_1" + "name": "psu1_fan1" } ], "thermals": [ @@ -108,7 +108,7 @@ "name": "PSU 2", "fans": [ { - "name": "psu_2_fan_1" + "name": "psu2_fan1" } ], "thermals": [ From 44f21a18ea23e081824f5fe28e0a340f8271748c Mon Sep 17 00:00:00 2001 From: judyjoseph <53951155+judyjoseph@users.noreply.github.com> Date: Fri, 7 May 2021 09:47:26 -0700 Subject: [PATCH 039/136] Port the fix to get the PCI_id from asic.conf file from 201911 --> master branch (#7513) Port the fix to get the pci_device ID from asic.conf file and update the "asic_id" field in DEVICE_METADATA with the pci_device_Id. Ref: https://github.com/Azure/sonic-buildimage/pull/4705 --- src/sonic-config-engine/sonic-cfggen | 9 ++++++-- .../sonic_py_common/multi_asic.py | 23 +++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index d895c0dde12c..c0d16ea9691e 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -41,7 +41,7 @@ from functools import partial from minigraph import minigraph_encoder, parse_xml, parse_device_desc_xml, parse_asic_sub_role 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 +from sonic_py_common.multi_asic import get_asic_id_from_name, get_asic_device_id from sonic_py_common import device_info from swsscommon.swsscommon import SonicV2Connector, ConfigDBConnector, SonicDBConfig, ConfigDBPipeConnector @@ -380,7 +380,12 @@ def main(): }}} # The ID needs to be passed to the SAI to identify the asic. if asic_name is not None: - hardware_data['DEVICE_METADATA']['localhost'].update(asic_id=asic_id) + device_id = get_asic_device_id(asic_id) + # if the device_id obtained is None, exit with error + if device_id is None: + print('Failed to get device ID for', asic_name, file=sys.stderr) + sys.exit(1) + hardware_data['DEVICE_METADATA']['localhost'].update(asic_id=device_id) deep_update(data, hardware_data) paths = ['/', '/usr/share/sonic/templates'] 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 3bb2984c8b95..1666fb47df1c 100644 --- a/src/sonic-py-common/sonic_py_common/multi_asic.py +++ b/src/sonic-py-common/sonic_py_common/multi_asic.py @@ -137,6 +137,29 @@ def get_asic_id_from_name(asic_name): else: raise ValueError('Unknown asic namespace name {}'.format(asic_name)) +def get_asic_device_id(asic_id): + # Get asic.conf file + asic_conf_file_path = get_asic_conf_file_path() + + if asic_conf_file_path is None: + return None + + # In a multi-asic device we need to have the file "asic.conf" updated with the asic instance + # and the corresponding device id which could be pci_id. Below is an eg: for a 2 ASIC platform/sku. + # DEV_ID_ASIC_0=03:00.0 + # DEV_ID_ASIC_1=04:00.0 + device_str = "DEV_ID_ASIC_{}".format(asic_id) + + with open(asic_conf_file_path) as asic_conf_file: + for line in asic_conf_file: + tokens = line.split('=') + if len(tokens) < 2: + continue + if tokens[0] == device_str: + device_id = tokens[1].strip() + return device_id + + return None def get_current_namespace(pid=None): """ From 67f293912f07bb0f4e7b9758e073c597f648265b Mon Sep 17 00:00:00 2001 From: ArthiSivanantham Date: Fri, 7 May 2021 15:22:34 -0700 Subject: [PATCH 040/136] [yang]: modify Vlan Member to include PortChannel along with Port (#7407) To include PortChannel as Vlan Member (in addition to the already existing physical port) Signed-off-by: Arthi Sivanantham --- .../tests/files/sample_config_db.json | 3 ++ .../tests/yang_model_tests/tests/vlan.json | 9 +++- .../yang_model_tests/tests_config/vlan.json | 50 +++++++++++++++++++ .../yang-models/sonic-vlan.yang | 17 ++++++- 4 files changed, 76 insertions(+), 3 deletions(-) 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 699ce6ad10b3..47ae37d9e10d 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -624,6 +624,9 @@ }, "Vlan111|Ethernet36": { "tagging_mode": "untagged" + }, + "Vlan111|PortChannel0003": { + "tagging_mode": "untagged" } }, "LOOPBACK_INTERFACE": { 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 4682a1e3df31..e6cdd27b4625 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 @@ -19,7 +19,14 @@ }, "VLAN_WITH_NON_EXIST_PORT": { "desc": "Configure a member port in VLAN_MEMBER table which does not exist.", - "eStrKey" : "LeafRef" + "eStrKey" : "InvalidValue" + }, + "VLAN_WITH_PORTCHANNEL_MEMBER": { + "desc": "Configure a PortChannel as a member of Vlan." + }, + "VLAN_WITH_NON_EXIST_PORTCHANNEL_MEMBER": { + "desc": "Configure a non existent PortChannel as a member of Vlan.", + "eStrKey" : "InvalidValue" }, "VLAN_MEMEBER_WITH_NON_EXIST_VLAN": { "desc": "Configure vlan-id in VLAN_MEMBER table which does not exist in VLAN table.", 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 39c764c1813a..dd9874972fe9 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 @@ -172,6 +172,56 @@ } } }, + "VLAN_WITH_PORTCHANNEL_MEMBER": { + "sonic-portchannel:sonic-portchannel": { + "sonic-portchannel:PORTCHANNEL": { + "PORTCHANNEL_LIST": [ + { + "admin_status": "up", + "name": "PortChannel5" + } + ] + } + }, + "sonic-vlan:sonic-vlan": { + "sonic-vlan:VLAN": { + "VLAN_LIST": [ + { + "name": "Vlan200" + } + ] + }, + "sonic-vlan:VLAN_MEMBER": { + "VLAN_MEMBER_LIST": [ + { + "port": "PortChannel5", + "tagging_mode": "tagged", + "name": "Vlan200" + } + ] + } + } + }, + "VLAN_WITH_NON_EXIST_PORTCHANNEL_MEMBER": { + "sonic-vlan:sonic-vlan": { + "sonic-vlan:VLAN": { + "VLAN_LIST": [ + { + "name": "Vlan100" + } + ] + }, + "sonic-vlan:VLAN_MEMBER": { + "VLAN_MEMBER_LIST": [ + { + "port": "PortChannel1", + "tagging_mode": "tagged", + "name": "Vlan100" + } + ] + } + } + }, "WRONG_FAMILY_WITH_IP_PREFIX": { "sonic-vlan:sonic-vlan": { "sonic-vlan:VLAN": { diff --git a/src/sonic-yang-models/yang-models/sonic-vlan.yang b/src/sonic-yang-models/yang-models/sonic-vlan.yang index 2962161ef0fc..d2309965ebe1 100644 --- a/src/sonic-yang-models/yang-models/sonic-vlan.yang +++ b/src/sonic-yang-models/yang-models/sonic-vlan.yang @@ -24,12 +24,20 @@ module sonic-vlan { revision-date 2019-07-01; } + import sonic-portchannel { + prefix lag; + } + import sonic-vrf { prefix vrf; } description "VLAN yang Module for SONiC OS"; + revision 2021-04-22 { + description "Modify Vlan Member to include PortChannel along with Port"; + } + revision 2021-03-30 { description "Modify the type of vrf name"; } @@ -171,8 +179,13 @@ module sonic-vlan { leaf port { /* key elements are mandatory by default */ - type leafref { - path /port:sonic-port/port:PORT/port:PORT_LIST/port:name; + 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"; + } } } From 0a8023bbfda17e508eb67413cbb9847bc0be1611 Mon Sep 17 00:00:00 2001 From: DavidZagury <32644413+DavidZagury@users.noreply.github.com> Date: Sat, 8 May 2021 01:35:58 +0300 Subject: [PATCH 041/136] [DPB][YANG-models] Update portchannel yang model to have lacp_key (#7297) To update the yang model to support the new key interduced in Azure/sonic-swss#1660 --- .../tests/files/sample_config_db.json | 6 ++++-- .../tests_config/portchannel.json | 1 + .../yang-models/sonic-portchannel.yang | 16 +++++++++++++++- 3 files changed, 20 insertions(+), 3 deletions(-) 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 47ae37d9e10d..34a225b95633 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -11,7 +11,8 @@ "members": [ "Ethernet1" ], - "mtu": "9100" + "mtu": "9100", + "lacp_key": "auto" }, "PortChannel0004": { "admin_status": "up", @@ -19,7 +20,8 @@ "members": [ "Ethernet2" ], - "mtu": "9100" + "mtu": "9100", + "lacp_key": "auto" } }, "PORTCHANNEL_INTERFACE": { diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/portchannel.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/portchannel.json index 6f86853faa25..d5a3a6f64383 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/portchannel.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/portchannel.json @@ -25,6 +25,7 @@ ], "min_links": "1", "mtu": "9100", + "lacp_key": "auto", "name": "PortChannel0001" } ] diff --git a/src/sonic-yang-models/yang-models/sonic-portchannel.yang b/src/sonic-yang-models/yang-models/sonic-portchannel.yang index 8d413cea2b3b..70e9c7d69711 100644 --- a/src/sonic-yang-models/yang-models/sonic-portchannel.yang +++ b/src/sonic-yang-models/yang-models/sonic-portchannel.yang @@ -95,7 +95,21 @@ module sonic-portchannel { mandatory true; type stypes:admin_status; } - } /* end of list PORTCHANNEL_LIST */ + + leaf lacp_key { + /* lacp key should be either auto or a integer in the range of 1 to 65535 */ + /* When lacp_key is set to 'auto' the lacp key would be set to be the number */ + /* on the end of the PortChannel name with a prefix of 1 */ + type union { + type string { + pattern "auto"; + } + type uint16 { + range 1..65535; + } + } + } + } /* end of list PORTCHANNEL_LIST */ } /* end of container PORTCHANNEL */ From 2803fafe04c2f39df3312b34e19dea7b59dbf18a Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Sat, 8 May 2021 10:32:33 -0700 Subject: [PATCH 042/136] [Arista] Update platform driver submodules (#7561) - Fix sonic_platform api "memory leak" tied to recurring allocation. fixes #7515 - Add arista clis to read chassis eeproms --- platform/barefoot/sonic-platform-modules-arista | 2 +- platform/broadcom/sonic-platform-modules-arista | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/barefoot/sonic-platform-modules-arista b/platform/barefoot/sonic-platform-modules-arista index 5c26cc044bc0..93d78acf0734 160000 --- a/platform/barefoot/sonic-platform-modules-arista +++ b/platform/barefoot/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 5c26cc044bc0a218c5572c5a36450df4c4f436d8 +Subproject commit 93d78acf07343c5239df151b448c84b060a3e98f diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index 5c26cc044bc0..93d78acf0734 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 5c26cc044bc0a218c5572c5a36450df4c4f436d8 +Subproject commit 93d78acf07343c5239df151b448c84b060a3e98f From bfae15fb834e770d36e27b5bb1780370bc2ae2e0 Mon Sep 17 00:00:00 2001 From: Junchao-Mellanox <57339448+Junchao-Mellanox@users.noreply.github.com> Date: Sun, 9 May 2021 01:33:37 +0800 Subject: [PATCH 043/136] [mellaonox]: No need enable thermal zones in thermal_manager.deinitialize since they are enabled by default (#7556) No need enable thermal zones in thermal_manager.deinitialize since they are enabled by default. And removing this will faster thermalctld exit speed --- .../mlnx-platform-api/sonic_platform/thermal_manager.py | 9 --------- 1 file changed, 9 deletions(-) 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 914eec79816c..c2acf49a2245 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/thermal_manager.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/thermal_manager.py @@ -16,15 +16,6 @@ def initialize(cls): """ cls._add_private_thermal_policy() - @classmethod - def deinitialize(cls): - """ - Destroy thermal manager, including any vendor specific cleanup. The default behavior of this function - is a no-op. - :return: - """ - cls.start_thermal_control_algorithm() - @classmethod def start_thermal_control_algorithm(cls): """ From 51b7c756e3893f04c6a30ee5b070883ecb59187f Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Sun, 9 May 2021 09:02:49 -0700 Subject: [PATCH 044/136] [linux kernel] advance linux kernel submodule head (#7559) To include change: * 12d8a0a 2021-05-06 | [dps200] Add dps200 PSU module driver (#207) (HEAD, origin/master, origin/HEAD) [schobtr] Signed-off-by: Ying Xie --- src/sonic-linux-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index 99ad21026954..12d8a0a71d38 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit 99ad21026954f58b364cd20815e38777fc5195fd +Subproject commit 12d8a0a71d3807ecd43c485dc903973d3b5c70a9 From da7c80da9d399ff7200ae993fc11a5719a97df3e Mon Sep 17 00:00:00 2001 From: schobtr Date: Sun, 9 May 2021 23:03:12 +0700 Subject: [PATCH 045/136] [Haliburton-Celestica] Use psu driver dps200 from Linux kernel (#7247) Why I did it Fix issues below. #7133 #6602 So, remove the dps200 driver from the platform-specific driver. Then, add the dps200 module driver to the Linux kernel tree. How I did it Remove the dps200 driver from the platform-specific driver and add the dps200 module driver to the Linux kernel. How to verify it Build an image with Azure/sonic-linux-kernel#207 Then, install to the Haliburton. --- .../haliburton/modules/Makefile | 2 +- .../haliburton/modules/dps200.c | 128 ------ .../haliburton/modules/pmbus.h | 425 ------------------ 3 files changed, 1 insertion(+), 554 deletions(-) delete mode 100644 platform/broadcom/sonic-platform-modules-cel/haliburton/modules/dps200.c delete mode 100644 platform/broadcom/sonic-platform-modules-cel/haliburton/modules/pmbus.h diff --git a/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/Makefile b/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/Makefile index 415d1b5e62f0..b34cf2cabe20 100644 --- a/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/Makefile +++ b/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/Makefile @@ -1 +1 @@ -obj-m := mc24lc64t.o emc2305.o smc.o hlx_gpio_ich.o dps200.o +obj-m := mc24lc64t.o emc2305.o smc.o hlx_gpio_ich.o diff --git a/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/dps200.c b/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/dps200.c deleted file mode 100644 index 6279ca70decf..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/dps200.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Hardware monitoring driver for Delta DPS200 - * - * (C) Copyright 2019, Celestica Inc. - * Author: Pradchaya Phucharoen - * - * 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.h" - - -static int dps200_read_word_data(struct i2c_client *client, int page, int reg) -{ - - if (reg >= PMBUS_VIRT_BASE || - reg == PMBUS_VOUT_OV_FAULT_LIMIT || - reg == PMBUS_VOUT_OV_WARN_LIMIT || - reg == PMBUS_VOUT_UV_WARN_LIMIT || - reg == PMBUS_VOUT_UV_FAULT_LIMIT || - reg == PMBUS_IOUT_OC_LV_FAULT_LIMIT || - reg == PMBUS_IOUT_UC_FAULT_LIMIT || - reg == PMBUS_UT_WARN_LIMIT || - reg == PMBUS_UT_FAULT_LIMIT || - reg == PMBUS_VIN_OV_FAULT_LIMIT || - reg == PMBUS_VIN_OV_WARN_LIMIT || - reg == PMBUS_IIN_OC_FAULT_LIMIT || - reg == PMBUS_POUT_MAX) - return -ENXIO; - - /* - * WARNING: The following feild have coinstant driver value. - * If the register are - * PMBUS_IOUT_OC_WARN_LIMIT or PMBUS_IOUT_OC_FAULT_LIMIT convert - * the constant value from linear to direct fomat. - */ - if (reg == PMBUS_IOUT_OC_WARN_LIMIT) - return 0xb4; - else if (reg == PMBUS_IOUT_OC_FAULT_LIMIT) - return 0xc8; - else - return pmbus_read_word_data(client, page, reg); -} - -/* - * Form DPS-200 datasheet the supported sensors format defined as: - * VOUT: direct mode with one decimal place. - * - * Other sensors: - * IOUT: direct mode with one decimal place. - * IOUT Limits: linear mode, which difference from IOUT. - * VIN, IIN, POWER, TEMP, & FAN: linear mode. - */ -static struct pmbus_driver_info dps200_info = { - .pages = 1, - .func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT - | PMBUS_HAVE_IIN | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT - | PMBUS_HAVE_PIN | PMBUS_HAVE_POUT - | PMBUS_HAVE_FAN12 | PMBUS_HAVE_STATUS_FAN12 - | PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2 | PMBUS_HAVE_TEMP3 | PMBUS_HAVE_STATUS_TEMP - | PMBUS_HAVE_STATUS_INPUT, - .format = { - [PSC_VOLTAGE_OUT] = direct, - [PSC_CURRENT_OUT] = direct, - }, - .m = { - [PSC_VOLTAGE_OUT] = 10, - [PSC_CURRENT_OUT] = 10, - }, - .b = { - [PSC_VOLTAGE_OUT] = 0, - [PSC_CURRENT_OUT] = 0, - }, - .R = { - [PSC_VOLTAGE_OUT] = 0, - [PSC_CURRENT_OUT] = 0, - }, - .read_word_data = &dps200_read_word_data, -}; - -static int pmbus_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - return pmbus_do_probe(client, id, &dps200_info); -} -/* user driver datat to pass the grpup */ -static const struct i2c_device_id dps200_id[] = { - {"dps200", 0}, - {} -}; - -MODULE_DEVICE_TABLE(i2c, dps200_id); - -/* This is the driver that will be inserted */ -static struct i2c_driver dps200_driver = { - .driver = { - .name = "dps200", - }, - .probe = pmbus_probe, - .remove = pmbus_do_remove, - .id_table = dps200_id, -}; - -module_i2c_driver(dps200_driver); - -MODULE_AUTHOR("Pradchaya Phucharoen"); -MODULE_DESCRIPTION("PMBus driver for Delta DPS200"); -MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/pmbus.h b/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/pmbus.h deleted file mode 100644 index 521baf6da49a..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/pmbus.h +++ /dev/null @@ -1,425 +0,0 @@ -/* - * pmbus.h - Common defines and structures for PMBus devices - * - * Copyright (c) 2010, 2011 Ericsson AB. - * Copyright (c) 2012 Guenter Roeck - * - * 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 PMBUS_H -#define PMBUS_H - -#include -#include - -/* - * Registers - */ -enum pmbus_regs { - PMBUS_PAGE = 0x00, - PMBUS_OPERATION = 0x01, - PMBUS_ON_OFF_CONFIG = 0x02, - PMBUS_CLEAR_FAULTS = 0x03, - PMBUS_PHASE = 0x04, - - PMBUS_CAPABILITY = 0x19, - PMBUS_QUERY = 0x1A, - - PMBUS_VOUT_MODE = 0x20, - PMBUS_VOUT_COMMAND = 0x21, - PMBUS_VOUT_TRIM = 0x22, - PMBUS_VOUT_CAL_OFFSET = 0x23, - PMBUS_VOUT_MAX = 0x24, - PMBUS_VOUT_MARGIN_HIGH = 0x25, - PMBUS_VOUT_MARGIN_LOW = 0x26, - PMBUS_VOUT_TRANSITION_RATE = 0x27, - PMBUS_VOUT_DROOP = 0x28, - PMBUS_VOUT_SCALE_LOOP = 0x29, - PMBUS_VOUT_SCALE_MONITOR = 0x2A, - - PMBUS_COEFFICIENTS = 0x30, - PMBUS_POUT_MAX = 0x31, - - PMBUS_FAN_CONFIG_12 = 0x3A, - PMBUS_FAN_COMMAND_1 = 0x3B, - PMBUS_FAN_COMMAND_2 = 0x3C, - PMBUS_FAN_CONFIG_34 = 0x3D, - PMBUS_FAN_COMMAND_3 = 0x3E, - PMBUS_FAN_COMMAND_4 = 0x3F, - - PMBUS_VOUT_OV_FAULT_LIMIT = 0x40, - PMBUS_VOUT_OV_FAULT_RESPONSE = 0x41, - PMBUS_VOUT_OV_WARN_LIMIT = 0x42, - PMBUS_VOUT_UV_WARN_LIMIT = 0x43, - PMBUS_VOUT_UV_FAULT_LIMIT = 0x44, - PMBUS_VOUT_UV_FAULT_RESPONSE = 0x45, - PMBUS_IOUT_OC_FAULT_LIMIT = 0x46, - PMBUS_IOUT_OC_FAULT_RESPONSE = 0x47, - PMBUS_IOUT_OC_LV_FAULT_LIMIT = 0x48, - PMBUS_IOUT_OC_LV_FAULT_RESPONSE = 0x49, - PMBUS_IOUT_OC_WARN_LIMIT = 0x4A, - PMBUS_IOUT_UC_FAULT_LIMIT = 0x4B, - PMBUS_IOUT_UC_FAULT_RESPONSE = 0x4C, - - PMBUS_OT_FAULT_LIMIT = 0x4F, - PMBUS_OT_FAULT_RESPONSE = 0x50, - PMBUS_OT_WARN_LIMIT = 0x51, - PMBUS_UT_WARN_LIMIT = 0x52, - PMBUS_UT_FAULT_LIMIT = 0x53, - PMBUS_UT_FAULT_RESPONSE = 0x54, - PMBUS_VIN_OV_FAULT_LIMIT = 0x55, - PMBUS_VIN_OV_FAULT_RESPONSE = 0x56, - PMBUS_VIN_OV_WARN_LIMIT = 0x57, - PMBUS_VIN_UV_WARN_LIMIT = 0x58, - PMBUS_VIN_UV_FAULT_LIMIT = 0x59, - - PMBUS_IIN_OC_FAULT_LIMIT = 0x5B, - PMBUS_IIN_OC_WARN_LIMIT = 0x5D, - - PMBUS_POUT_OP_FAULT_LIMIT = 0x68, - PMBUS_POUT_OP_WARN_LIMIT = 0x6A, - PMBUS_PIN_OP_WARN_LIMIT = 0x6B, - - PMBUS_STATUS_BYTE = 0x78, - PMBUS_STATUS_WORD = 0x79, - PMBUS_STATUS_VOUT = 0x7A, - PMBUS_STATUS_IOUT = 0x7B, - PMBUS_STATUS_INPUT = 0x7C, - PMBUS_STATUS_TEMPERATURE = 0x7D, - PMBUS_STATUS_CML = 0x7E, - PMBUS_STATUS_OTHER = 0x7F, - PMBUS_STATUS_MFR_SPECIFIC = 0x80, - PMBUS_STATUS_FAN_12 = 0x81, - PMBUS_STATUS_FAN_34 = 0x82, - - PMBUS_READ_VIN = 0x88, - PMBUS_READ_IIN = 0x89, - PMBUS_READ_VCAP = 0x8A, - PMBUS_READ_VOUT = 0x8B, - PMBUS_READ_IOUT = 0x8C, - PMBUS_READ_TEMPERATURE_1 = 0x8D, - PMBUS_READ_TEMPERATURE_2 = 0x8E, - PMBUS_READ_TEMPERATURE_3 = 0x8F, - PMBUS_READ_FAN_SPEED_1 = 0x90, - PMBUS_READ_FAN_SPEED_2 = 0x91, - PMBUS_READ_FAN_SPEED_3 = 0x92, - PMBUS_READ_FAN_SPEED_4 = 0x93, - PMBUS_READ_DUTY_CYCLE = 0x94, - PMBUS_READ_FREQUENCY = 0x95, - PMBUS_READ_POUT = 0x96, - PMBUS_READ_PIN = 0x97, - - PMBUS_REVISION = 0x98, - PMBUS_MFR_ID = 0x99, - PMBUS_MFR_MODEL = 0x9A, - PMBUS_MFR_REVISION = 0x9B, - PMBUS_MFR_LOCATION = 0x9C, - 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. - */ - PMBUS_VIRT_BASE = 0x100, - PMBUS_VIRT_READ_TEMP_AVG, - PMBUS_VIRT_READ_TEMP_MIN, - PMBUS_VIRT_READ_TEMP_MAX, - PMBUS_VIRT_RESET_TEMP_HISTORY, - PMBUS_VIRT_READ_VIN_AVG, - PMBUS_VIRT_READ_VIN_MIN, - PMBUS_VIRT_READ_VIN_MAX, - PMBUS_VIRT_RESET_VIN_HISTORY, - PMBUS_VIRT_READ_IIN_AVG, - PMBUS_VIRT_READ_IIN_MIN, - PMBUS_VIRT_READ_IIN_MAX, - PMBUS_VIRT_RESET_IIN_HISTORY, - PMBUS_VIRT_READ_PIN_AVG, - PMBUS_VIRT_READ_PIN_MIN, - PMBUS_VIRT_READ_PIN_MAX, - PMBUS_VIRT_RESET_PIN_HISTORY, - PMBUS_VIRT_READ_POUT_AVG, - PMBUS_VIRT_READ_POUT_MIN, - PMBUS_VIRT_READ_POUT_MAX, - PMBUS_VIRT_RESET_POUT_HISTORY, - PMBUS_VIRT_READ_VOUT_AVG, - PMBUS_VIRT_READ_VOUT_MIN, - PMBUS_VIRT_READ_VOUT_MAX, - PMBUS_VIRT_RESET_VOUT_HISTORY, - PMBUS_VIRT_READ_IOUT_AVG, - PMBUS_VIRT_READ_IOUT_MIN, - PMBUS_VIRT_READ_IOUT_MAX, - PMBUS_VIRT_RESET_IOUT_HISTORY, - PMBUS_VIRT_READ_TEMP2_AVG, - PMBUS_VIRT_READ_TEMP2_MIN, - PMBUS_VIRT_READ_TEMP2_MAX, - PMBUS_VIRT_RESET_TEMP2_HISTORY, - - PMBUS_VIRT_READ_VMON, - PMBUS_VIRT_VMON_UV_WARN_LIMIT, - PMBUS_VIRT_VMON_OV_WARN_LIMIT, - PMBUS_VIRT_VMON_UV_FAULT_LIMIT, - PMBUS_VIRT_VMON_OV_FAULT_LIMIT, - PMBUS_VIRT_STATUS_VMON, -}; - -/* - * OPERATION - */ -#define PB_OPERATION_CONTROL_ON BIT(7) - -/* - * CAPABILITY - */ -#define PB_CAPABILITY_SMBALERT BIT(4) -#define PB_CAPABILITY_ERROR_CHECK BIT(7) - -/* - * VOUT_MODE - */ -#define PB_VOUT_MODE_MODE_MASK 0xe0 -#define PB_VOUT_MODE_PARAM_MASK 0x1f - -#define PB_VOUT_MODE_LINEAR 0x00 -#define PB_VOUT_MODE_VID 0x20 -#define PB_VOUT_MODE_DIRECT 0x40 - -/* - * Fan configuration - */ -#define PB_FAN_2_PULSE_MASK (BIT(0) | BIT(1)) -#define PB_FAN_2_RPM BIT(2) -#define PB_FAN_2_INSTALLED BIT(3) -#define PB_FAN_1_PULSE_MASK (BIT(4) | BIT(5)) -#define PB_FAN_1_RPM BIT(6) -#define PB_FAN_1_INSTALLED BIT(7) - -/* - * STATUS_BYTE, STATUS_WORD (lower) - */ -#define PB_STATUS_NONE_ABOVE BIT(0) -#define PB_STATUS_CML BIT(1) -#define PB_STATUS_TEMPERATURE BIT(2) -#define PB_STATUS_VIN_UV BIT(3) -#define PB_STATUS_IOUT_OC BIT(4) -#define PB_STATUS_VOUT_OV BIT(5) -#define PB_STATUS_OFF BIT(6) -#define PB_STATUS_BUSY BIT(7) - -/* - * STATUS_WORD (upper) - */ -#define PB_STATUS_UNKNOWN BIT(8) -#define PB_STATUS_OTHER BIT(9) -#define PB_STATUS_FANS BIT(10) -#define PB_STATUS_POWER_GOOD_N BIT(11) -#define PB_STATUS_WORD_MFR BIT(12) -#define PB_STATUS_INPUT BIT(13) -#define PB_STATUS_IOUT_POUT BIT(14) -#define PB_STATUS_VOUT BIT(15) - -/* - * STATUS_IOUT - */ -#define PB_POUT_OP_WARNING BIT(0) -#define PB_POUT_OP_FAULT BIT(1) -#define PB_POWER_LIMITING BIT(2) -#define PB_CURRENT_SHARE_FAULT BIT(3) -#define PB_IOUT_UC_FAULT BIT(4) -#define PB_IOUT_OC_WARNING BIT(5) -#define PB_IOUT_OC_LV_FAULT BIT(6) -#define PB_IOUT_OC_FAULT BIT(7) - -/* - * STATUS_VOUT, STATUS_INPUT - */ -#define PB_VOLTAGE_UV_FAULT BIT(4) -#define PB_VOLTAGE_UV_WARNING BIT(5) -#define PB_VOLTAGE_OV_WARNING BIT(6) -#define PB_VOLTAGE_OV_FAULT BIT(7) - -/* - * STATUS_INPUT - */ -#define PB_PIN_OP_WARNING BIT(0) -#define PB_IIN_OC_WARNING BIT(1) -#define PB_IIN_OC_FAULT BIT(2) - -/* - * STATUS_TEMPERATURE - */ -#define PB_TEMP_UT_FAULT BIT(4) -#define PB_TEMP_UT_WARNING BIT(5) -#define PB_TEMP_OT_WARNING BIT(6) -#define PB_TEMP_OT_FAULT BIT(7) - -/* - * STATUS_FAN - */ -#define PB_FAN_AIRFLOW_WARNING BIT(0) -#define PB_FAN_AIRFLOW_FAULT BIT(1) -#define PB_FAN_FAN2_SPEED_OVERRIDE BIT(2) -#define PB_FAN_FAN1_SPEED_OVERRIDE BIT(3) -#define PB_FAN_FAN2_WARNING BIT(4) -#define PB_FAN_FAN1_WARNING BIT(5) -#define PB_FAN_FAN2_FAULT BIT(6) -#define PB_FAN_FAN1_FAULT BIT(7) - -/* - * CML_FAULT_STATUS - */ -#define PB_CML_FAULT_OTHER_MEM_LOGIC BIT(0) -#define PB_CML_FAULT_OTHER_COMM BIT(1) -#define PB_CML_FAULT_PROCESSOR BIT(3) -#define PB_CML_FAULT_MEMORY BIT(4) -#define PB_CML_FAULT_PACKET_ERROR BIT(5) -#define PB_CML_FAULT_INVALID_DATA BIT(6) -#define PB_CML_FAULT_INVALID_COMMAND BIT(7) - -enum pmbus_sensor_classes { - PSC_VOLTAGE_IN = 0, - PSC_VOLTAGE_OUT, - PSC_CURRENT_IN, - PSC_CURRENT_OUT, - PSC_POWER, - PSC_TEMPERATURE, - PSC_FAN, - PSC_NUM_CLASSES /* Number of power sensor classes */ -}; - -#define PMBUS_PAGES 32 /* Per PMBus specification */ - -/* Functionality bit mask */ -#define PMBUS_HAVE_VIN BIT(0) -#define PMBUS_HAVE_VCAP BIT(1) -#define PMBUS_HAVE_VOUT BIT(2) -#define PMBUS_HAVE_IIN BIT(3) -#define PMBUS_HAVE_IOUT BIT(4) -#define PMBUS_HAVE_PIN BIT(5) -#define PMBUS_HAVE_POUT BIT(6) -#define PMBUS_HAVE_FAN12 BIT(7) -#define PMBUS_HAVE_FAN34 BIT(8) -#define PMBUS_HAVE_TEMP BIT(9) -#define PMBUS_HAVE_TEMP2 BIT(10) -#define PMBUS_HAVE_TEMP3 BIT(11) -#define PMBUS_HAVE_STATUS_VOUT BIT(12) -#define PMBUS_HAVE_STATUS_IOUT BIT(13) -#define PMBUS_HAVE_STATUS_INPUT BIT(14) -#define PMBUS_HAVE_STATUS_TEMP BIT(15) -#define PMBUS_HAVE_STATUS_FAN12 BIT(16) -#define PMBUS_HAVE_STATUS_FAN34 BIT(17) -#define PMBUS_HAVE_VMON BIT(18) -#define PMBUS_HAVE_STATUS_VMON BIT(19) - -enum pmbus_data_format { linear = 0, direct, vid }; -enum vrm_version { vr11 = 0, vr12 }; - -struct pmbus_driver_info { - int pages; /* Total number of pages */ - enum pmbus_data_format format[PSC_NUM_CLASSES]; - enum vrm_version vrm_version; - /* - * Support one set of coefficients for each sensor type - * Used for chips providing data in direct mode. - */ - int m[PSC_NUM_CLASSES]; /* mantissa for direct data format */ - int b[PSC_NUM_CLASSES]; /* offset */ - int R[PSC_NUM_CLASSES]; /* exponent */ - - u32 func[PMBUS_PAGES]; /* Functionality, per page */ - /* - * The following functions map manufacturing specific register values - * to PMBus standard register values. Specify only if mapping is - * necessary. - * Functions return the register value (read) or zero (write) if - * successful. A return value of -ENODATA indicates that there is no - * manufacturer specific register, but that a standard PMBus register - * may exist. Any other negative return value indicates that the - * register does not exist, and that no attempt should be made to read - * the standard register. - */ - 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); - int (*write_byte)(struct i2c_client *client, int page, u8 value); - /* - * The identify function determines supported PMBus functionality. - * This function is only necessary if a chip driver supports multiple - * chips, and the chip functionality is not pre-determined. - */ - int (*identify)(struct i2c_client *client, - struct pmbus_driver_info *info); - - /* Regulator functionality, if supported by this chip driver. */ - int num_regulators; - const struct regulator_desc *reg_desc; -}; - -/* Regulator ops */ - -extern const struct regulator_ops pmbus_regulator_ops; - -/* Macro for filling in array of struct regulator_desc */ -#define PMBUS_REGULATOR(_name, _id) \ - [_id] = { \ - .name = (_name # _id), \ - .id = (_id), \ - .of_match = of_match_ptr(_name # _id), \ - .regulators_node = of_match_ptr("regulators"), \ - .ops = &pmbus_regulator_ops, \ - .type = REGULATOR_VOLTAGE, \ - .owner = THIS_MODULE, \ - } - -/* 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_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); -int pmbus_update_byte_data(struct i2c_client *client, int page, u8 reg, - 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); -int pmbus_do_remove(struct i2c_client *client); -const struct pmbus_driver_info *pmbus_get_driver_info(struct i2c_client - *client); - -#endif /* PMBUS_H */ \ No newline at end of file From 3dc879bbcf9645eddf6c395e636a881bc70b4e27 Mon Sep 17 00:00:00 2001 From: Aravind Mani <53524901+aravindmani-1@users.noreply.github.com> Date: Mon, 10 May 2021 14:40:06 -0700 Subject: [PATCH 046/136] DellEMC: Fix Z9332f xcvrd crash (#7544) --- .../z9332f/sonic_platform/sfp.py | 65 ++++++++++++------- 1 file changed, 41 insertions(+), 24 deletions(-) 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 7934b08626bf..318e9485b88f 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 @@ -499,7 +499,7 @@ def get_transceiver_info(self): 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['cable_length'] = str(float(cable_length)) transceiver_info_dict['nominal_bit_rate'] = bit_rate transceiver_info_dict['specification_compliance'] = str(compliance_code_dict) @@ -643,8 +643,8 @@ def get_transceiver_threshold_info(self): threshold_dict_keys, 'N/A') try: + module_threshold_data = self._get_eeprom_data('ModuleThreshold') if self.sfp_type == 'QSFP_DD': - module_threshold_data = self._get_eeprom_data('ModuleThreshold') 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'] @@ -666,7 +666,6 @@ def get_transceiver_threshold_info(self): 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': - module_threshold_data = self._get_eeprom_data('ModuleThreshold') 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'] @@ -766,12 +765,15 @@ def get_transceiver_bulk_status(self): transceiver_dom_dict['tx7bias'] = tx_bias_list[6] transceiver_dom_dict['tx8bias'] = tx_bias_list[7] - else: + elif self.sfp_type == 'QSFP': 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] + else: + if tx_bias_list is not None: + transceiver_dom_dict['tx1bias'] = tx_bias_list[0] if self.sfp_type == 'QSFP_DD': if rx_power_list is not None: @@ -784,12 +786,15 @@ def get_transceiver_bulk_status(self): transceiver_dom_dict['rx7power'] = rx_power_list[6] transceiver_dom_dict['rx8power'] = rx_power_list[7] - else: + elif self.sfp_type == 'QSFP': 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] + else: + if rx_power_list is not None: + transceiver_dom_dict['rx1power'] = rx_power_list[0] if self.sfp_type == 'QSFP_DD': if tx_power_list is not None: @@ -801,13 +806,15 @@ def get_transceiver_bulk_status(self): transceiver_dom_dict['tx6power'] = tx_power_list[5] transceiver_dom_dict['tx7power'] = tx_power_list[6] transceiver_dom_dict['tx8power'] = tx_power_list[7] - else: + elif self.sfp_type == 'QSFP': 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] - + else: + if tx_power_list is not None: + 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 @@ -932,10 +939,10 @@ def get_tx_fault(self): tx_fault_list = [] try: if self.sfp_type == 'QSFP_DD': - tx_fault_list = False + 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') : + 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) @@ -1022,7 +1029,7 @@ def get_temperature(self): """ Retrieves the temperature of this SFP """ - temperature = None + temperature = 0.0 try: if self.sfp_type == 'QSFP_DD': if self.qsfp_dd_DomInfo is None: @@ -1032,10 +1039,10 @@ def get_temperature(self): return None temperature_data = self.qsfp_dd_DomInfo.parse_temperature(dom_data_raw, 0) - elif self.sfp_type == 'QSFP': + else: temperature_data = self._get_eeprom_data('Temperature') - - temperature = self._strip_unit_from_str(temperature_data['data']['Temperature']['value']) + if temperature_data is not None: + temperature = self._strip_unit_from_str(temperature_data['data']['Temperature']['value']) except (TypeError, ValueError): return None return temperature @@ -1044,7 +1051,7 @@ def get_voltage(self): """ Retrieves the supply voltage of this SFP """ - voltage = None + voltage = 0.0 try: if self.sfp_type == 'QSFP_DD': if self.qsfp_dd_DomInfo is None: @@ -1054,11 +1061,10 @@ def get_voltage(self): return None voltage_data = self.qsfp_dd_DomInfo.parse_voltage(dom_data_raw, 0) - elif self.sfp_type == 'QSFP': + else: voltage_data = self._get_eeprom_data('Voltage') - - voltage = self._strip_unit_from_str(voltage_data['data']['Vcc']['value']) - + if voltage_data is not None: + voltage = self._strip_unit_from_str(voltage_data['data']['Vcc']['value']) except (TypeError, ValueError): return None return voltage @@ -1089,8 +1095,12 @@ def get_tx_bias(self): tx_bias = self._strip_unit_from_str(tx_bias_data['data'][tx_bias_id]['value']) tx_bias_list.append(tx_bias) else: - tx1_bias = self._strip_unit_from_str(tx_bias_data['data']['TXBias']['value']) - tx_bias_list.append(tx1_bias) + 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) + else: + tx_bias_list.append(0.0) except (TypeError, ValueError): return None @@ -1101,13 +1111,14 @@ def get_rx_power(self): Retrieves the received optical power for this SFP """ rx_power_list = [] - offset = 128 try: if self.sfp_type == 'QSFP_DD': if self.qsfp_dd_DomInfo is None: return None if not self.dom_rx_power_supported: return None + + offset = 128 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) @@ -1122,7 +1133,11 @@ def get_rx_power(self): rx_power = rx_power_data['data'][rx_power_id]['value'] rx_power_list.append(rx_power) else: - rx1_pw = self._strip_unit_from_str(rx_power_data['data']['RXPower']['value']) + 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']) + else: + rx1_pw = 0.0 rx_power_list.append(rx1_pw) except (TypeError, ValueError): return None @@ -1171,7 +1186,10 @@ def get_tx_power(self): tx_power_list.append(tx_pw) else: channel_monitor_data = self._get_eeprom_data('ChannelMonitor') - tx1_pw = self._strip_unit_from_str(channel_monitor_data['data']['TXPower']['value']) + if channel_monitor_data is not None: + tx1_pw = self._strip_unit_from_str(channel_monitor_data['data']['TXPower']['value']) + else: + tx1_pw = 0.0 tx_power_list.append(tx1_pw) except (TypeError, ValueError): return None @@ -1290,7 +1308,6 @@ def get_port_form_factor(self): 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 From b6c0dd652a010a887e3260abf6b07694e422297e Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Tue, 11 May 2021 13:21:48 -0700 Subject: [PATCH 047/136] [utilities] advance utililies submodule head (#7580) Include fullowing changes: * 9fc630c 2021-05-11 | [sonic_installer] temporary fix: don't migrate packages on aboot platforms (#1607) (github/master) [Stepan Blyshchak] * fde1d95 2021-05-11 | [config][vxlan] fix 'vxlan evpn_nvo add' command error (#1511) [shikenghua] * 331c5a5 2021-05-10 | [config]: Use mod_entry when editing VLAN_INTERFACE (#1602) [Lawrence Lee] * 8c2980a 2021-05-08 | [sonic-utilities] CLI support for port auto negotiation (#1568) [Junchao-Mellanox] * a71ff02 2021-05-06 | [sfpshow] Gracefully handle improper 'specification_compliance' field (#1594) [Joe LeVeque] Signed-off-by: Ying Xie --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 9a88cb6f0fba..9fc630c552d5 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 9a88cb6f0fbaf5fc8c336723cc7b831c6aacf19b +Subproject commit 9fc630c552d5f4cfa89fb9f84f40c975e1de9168 From 0c5927816849b0442f49e6fe79187085ba233421 Mon Sep 17 00:00:00 2001 From: pra-moh <49077256+pra-moh@users.noreply.github.com> Date: Tue, 11 May 2021 14:51:56 -0700 Subject: [PATCH 048/136] [Telemetry docker] add memory and memory swap limits (#7062) #### Why I did it Fix https://github.com/Azure/sonic-telemetry/issues/71 #### How I did it Added memory limit for telemetry docker. Historical docker memory usage shows telemetry docker consuming 150-200MB memory. Adding some extra buffer. --- rules/docker-telemetry.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/rules/docker-telemetry.mk b/rules/docker-telemetry.mk index 4a1dd9e67d29..8bdfe26e7386 100644 --- a/rules/docker-telemetry.mk +++ b/rules/docker-telemetry.mk @@ -29,6 +29,7 @@ endif $(DOCKER_TELEMETRY)_CONTAINER_NAME = telemetry $(DOCKER_TELEMETRY)_RUN_OPT += --privileged -t +$(DOCKER_TELEMETRY)_RUN_OPT += --memory 500m $(DOCKER_TELEMETRY)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_TELEMETRY)_RUN_OPT += -v /usr/share/sonic/scripts:/usr/share/sonic/scripts:ro $(DOCKER_TELEMETRY)_RUN_OPT += -v /var/run/dbus:/var/run/dbus:rw From b64a6402d0b09d10276b35ca0ca50996ca34964f Mon Sep 17 00:00:00 2001 From: pra-moh <49077256+pra-moh@users.noreply.github.com> Date: Tue, 11 May 2021 17:11:54 -0700 Subject: [PATCH 049/136] Revert "[Telemetry docker] add memory and memory swap limits (#7062)" (#7582) This reverts commit 0c5927816849b0442f49e6fe79187085ba233421. --- rules/docker-telemetry.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/rules/docker-telemetry.mk b/rules/docker-telemetry.mk index 8bdfe26e7386..4a1dd9e67d29 100644 --- a/rules/docker-telemetry.mk +++ b/rules/docker-telemetry.mk @@ -29,7 +29,6 @@ endif $(DOCKER_TELEMETRY)_CONTAINER_NAME = telemetry $(DOCKER_TELEMETRY)_RUN_OPT += --privileged -t -$(DOCKER_TELEMETRY)_RUN_OPT += --memory 500m $(DOCKER_TELEMETRY)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_TELEMETRY)_RUN_OPT += -v /usr/share/sonic/scripts:/usr/share/sonic/scripts:ro $(DOCKER_TELEMETRY)_RUN_OPT += -v /var/run/dbus:/var/run/dbus:rw From a070f1a2392dd4858303782e9d67692956fdad68 Mon Sep 17 00:00:00 2001 From: ec-michael-shih <71379738+ec-michael-shih@users.noreply.github.com> Date: Wed, 12 May 2021 10:06:36 +0800 Subject: [PATCH 050/136] [Platform] Accton add to support as9726-32d platform. (#7479) Add support for Accton as9726-32d platform This pull request is based on as9716-32d, so I reference as9716-32d to create new model: as9726-32d. This module do not need led driver to control led, FPGA can handle it. I also implement API2.0(sonic_platform) for this model, CPLD driver, PSU driver, Fan driver to control these HW behavior. --- .../Accton-AS9726-32D/port_config.ini | 35 + .../x86_64-accton_as9726_32d-r0/default_sku | 1 + .../installer.conf | 3 + .../plugins/eeprom.py | 13 + .../plugins/psuutil.py | 61 + .../plugins/sfputil.py | 293 +++ .../pmon_daemon_control.json | 5 + .../sonic_platform/__init__.py | 2 + .../sonic_platform/chassis.py | 201 ++ .../sonic_platform/component.py | 121 + .../sonic_platform/eeprom.py | 102 + .../sonic_platform/fan.py | 171 ++ .../sonic_platform/helper.py | 117 + .../sonic_platform/platform.py | 21 + .../sonic_platform/psu.py | 226 ++ .../sonic_platform/sfp.py | 2221 +++++++++++++++++ .../sonic_platform/thermal.py | 151 ++ platform/broadcom/one-image.mk | 1 + platform/broadcom/platform-modules-accton.mk | 6 + .../as9726-32d/classes/__init__.py | 0 .../as9726-32d/classes/fanutil.py | 216 ++ .../as9726-32d/classes/thermalutil.py | 89 + .../as9726-32d/modules/Makefile | 19 + .../modules/x86-64-accton-as9726-32d-cpld.c | 987 ++++++++ .../modules/x86-64-accton-as9726-32d-fan.c | 717 ++++++ .../modules/x86-64-accton-as9726-32d-psu.c | 321 +++ .../as9726-32d/modules/ym2651y.c | 678 +++++ .../as9726-32d-platform-monitor-fan.service | 16 + .../as9726-32d-platform-monitor-psu.service | 16 + .../as9726-32d-platform-monitor.service | 17 + .../as9726-32d/setup.py | 14 + .../as9726-32d/sonic_platform_setup.py | 34 + .../as9726-32d/utils/README | 65 + .../utils/accton_as9726_32d_monitor.py | 565 +++++ .../utils/accton_as9726_32d_monitor_fan.py | 186 ++ .../utils/accton_as9726_32d_monitor_psu.py | 159 ++ .../utils/accton_as9726_32d_util.py | 680 +++++ .../debian/control | 4 + .../debian/rules | 2 +- .../sonic-platform-accton-as9726-32d.install | 2 + 40 files changed, 8537 insertions(+), 1 deletion(-) create mode 100644 device/accton/x86_64-accton_as9726_32d-r0/Accton-AS9726-32D/port_config.ini create mode 100644 device/accton/x86_64-accton_as9726_32d-r0/default_sku create mode 100644 device/accton/x86_64-accton_as9726_32d-r0/installer.conf create mode 100755 device/accton/x86_64-accton_as9726_32d-r0/plugins/eeprom.py create mode 100755 device/accton/x86_64-accton_as9726_32d-r0/plugins/psuutil.py create mode 100755 device/accton/x86_64-accton_as9726_32d-r0/plugins/sfputil.py create mode 100644 device/accton/x86_64-accton_as9726_32d-r0/pmon_daemon_control.json create mode 100644 device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/__init__.py create mode 100644 device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/chassis.py create mode 100644 device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/component.py create mode 100644 device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/eeprom.py create mode 100644 device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/fan.py create mode 100644 device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/helper.py create mode 100644 device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/platform.py create mode 100644 device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/psu.py create mode 100644 device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/sfp.py create mode 100644 device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/thermal.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as9726-32d/classes/__init__.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as9726-32d/classes/fanutil.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as9726-32d/classes/thermalutil.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as9726-32d/modules/Makefile create mode 100755 platform/broadcom/sonic-platform-modules-accton/as9726-32d/modules/x86-64-accton-as9726-32d-cpld.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as9726-32d/modules/x86-64-accton-as9726-32d-fan.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as9726-32d/modules/x86-64-accton-as9726-32d-psu.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as9726-32d/modules/ym2651y.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as9726-32d/service/as9726-32d-platform-monitor-fan.service create mode 100644 platform/broadcom/sonic-platform-modules-accton/as9726-32d/service/as9726-32d-platform-monitor-psu.service create mode 100644 platform/broadcom/sonic-platform-modules-accton/as9726-32d/service/as9726-32d-platform-monitor.service create mode 100755 platform/broadcom/sonic-platform-modules-accton/as9726-32d/setup.py create mode 100644 platform/broadcom/sonic-platform-modules-accton/as9726-32d/sonic_platform_setup.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as9726-32d/utils/README create mode 100755 platform/broadcom/sonic-platform-modules-accton/as9726-32d/utils/accton_as9726_32d_monitor.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as9726-32d/utils/accton_as9726_32d_monitor_fan.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as9726-32d/utils/accton_as9726_32d_monitor_psu.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as9726-32d/utils/accton_as9726_32d_util.py create mode 100644 platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as9726-32d.install diff --git a/device/accton/x86_64-accton_as9726_32d-r0/Accton-AS9726-32D/port_config.ini b/device/accton/x86_64-accton_as9726_32d-r0/Accton-AS9726-32D/port_config.ini new file mode 100644 index 000000000000..f7fcf8517df8 --- /dev/null +++ b/device/accton/x86_64-accton_as9726_32d-r0/Accton-AS9726-32D/port_config.ini @@ -0,0 +1,35 @@ +# name lanes alias index speed +Ethernet1 73,74,75,76,77,78,79,80 fourHundredGigE1 1 400000 +Ethernet2 65,66,67,68,69,70,71,72 fourHundredGigE2 2 400000 +Ethernet3 81,82,83,84,85,86,87,88 fourHundredGigE3 3 400000 +Ethernet4 89,90,91,92,93,94,95,96 fourHundredGigE4 4 400000 +Ethernet5 97,98,99,100,101,102,103,104 fourHundredGigE5 5 400000 +Ethernet6 105,106,107,108,109,110,111,112 fourHundredGigE6 6 400000 +Ethernet7 113,114,115,116,117,118,119,120 fourHundredGigE7 7 400000 +Ethernet8 121,122,123,124,125,126,127,128 fourHundredGigE8 8 400000 +Ethernet9 41,42,43,44,45,46,47,48 fourHundredGigE9 9 400000 +Ethernet10 33,34,35,36,37,38,39,40 fourHundredGigE10 10 400000 +Ethernet11 49,50,51,52,53,54,55,56 fourHundredGigE11 11 400000 +Ethernet12 57,58,59,60,61,62,63,64 fourHundredGigE12 12 400000 +Ethernet13 129,130,131,132,133,134,135,136 fourHundredGigE13 13 400000 +Ethernet14 137,138,139,140,141,142,143,144 fourHundredGigE14 14 400000 +Ethernet15 145,146,147,148,149,150,151,152 fourHundredGigE15 15 400000 +Ethernet16 153,154,155,156,157,158,159,160 fourHundredGigE16 16 400000 +Ethernet17 169,170,171,172,173,174,175,176 fourHundredGigE17 17 400000 +Ethernet18 161,162,163,164,165,166,167,168 fourHundredGigE18 18 400000 +Ethernet19 177,178,179,180,181,182,183,184 fourHundredGigE19 19 400000 +Ethernet20 185,186,187,188,189,190,191,192 fourHundredGigE20 20 400000 +Ethernet21 1,2,3,4,5,6,7,8 fourHundredGigE21 21 400000 +Ethernet22 9,10,11,12,13,14,15,16 fourHundredGigE22 22 400000 +Ethernet23 17,18,19,20,21,22,23,24 fourHundredGigE23 23 400000 +Ethernet24 25,26,27,28,29,30,31,32 fourHundredGigE24 24 400000 +Ethernet25 201,202,203,204,205,206,207,208 fourHundredGigE25 25 400000 +Ethernet26 193,194,195,196,197,198,199,200 fourHundredGigE26 26 400000 +Ethernet27 217,218,219,220,221,222,223,224 fourHundredGigE27 27 400000 +Ethernet28 209,210,211,212,213,214,215,216 fourHundredGigE28 28 400000 +Ethernet29 233,234,235,236,237,238,239,240 fourHundredGigE29 29 400000 +Ethernet30 225,226,227,228,229,230,231,232 fourHundredGigE30 30 400000 +Ethernet31 249,250,251,252,253,254,255,256 fourHundredGigE31 31 400000 +Ethernet32 241,242,243,244,245,246,247,248 fourHundredGigE32 32 400000 +Ethernet33 249 tenGigE33 33 10000 +Ethernet34 250 tenGigE34 34 10000 diff --git a/device/accton/x86_64-accton_as9726_32d-r0/default_sku b/device/accton/x86_64-accton_as9726_32d-r0/default_sku new file mode 100644 index 000000000000..bfc864f74c74 --- /dev/null +++ b/device/accton/x86_64-accton_as9726_32d-r0/default_sku @@ -0,0 +1 @@ +Accton-AS9726-32D t1 diff --git a/device/accton/x86_64-accton_as9726_32d-r0/installer.conf b/device/accton/x86_64-accton_as9726_32d-r0/installer.conf new file mode 100644 index 000000000000..925a32fc0c3a --- /dev/null +++ b/device/accton/x86_64-accton_as9726_32d-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 diff --git a/device/accton/x86_64-accton_as9726_32d-r0/plugins/eeprom.py b/device/accton/x86_64-accton_as9726_32d-r0/plugins/eeprom.py new file mode 100755 index 000000000000..7409239d01f3 --- /dev/null +++ b/device/accton/x86_64-accton_as9726_32d-r0/plugins/eeprom.py @@ -0,0 +1,13 @@ +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/1-0057/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/accton/x86_64-accton_as9726_32d-r0/plugins/psuutil.py b/device/accton/x86_64-accton_as9726_32d-r0/plugins/psuutil.py new file mode 100755 index 000000000000..104fee28c8b5 --- /dev/null +++ b/device/accton/x86_64-accton_as9726_32d-r0/plugins/psuutil.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python + +############################################################################# +# Accton +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + + +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) + + self.psu_path = "/sys/bus/i2c/devices/" + self.psu_presence = "/psu_present" + self.psu_oper_status = "/psu_power_good" + self.psu_mapping = { + 1: "9-0050", + 2: "9-0051", + } + + def get_num_psus(self): + return len(self.psu_mapping) + + def get_psu_status(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping[index] + 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_psu_presence(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping[index] + self.psu_presence + try: + with open(node, 'r') as presence_status: + status = int(presence_status.read()) + except IOError: + return False + + return status == 1 diff --git a/device/accton/x86_64-accton_as9726_32d-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as9726_32d-r0/plugins/sfputil.py new file mode 100755 index 000000000000..2a365815cab6 --- /dev/null +++ b/device/accton/x86_64-accton_as9726_32d-r0/plugins/sfputil.py @@ -0,0 +1,293 @@ +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# + +try: + import time + from ctypes import create_string_buffer + 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 = 1 + QSFP_PORT_END = 32 + PORT_END = 34 + PORTS_IN_BLOCK = 34 + + BASE_OOM_PATH = "/sys/bus/i2c/devices/{0}-0050/" + BASE_CPLD2_PATH = "/sys/bus/i2c/devices/10-0061/" + BASE_CPLD3_PATH = "/sys/bus/i2c/devices/10-0062/" + + _port_to_is_present = {} + _port_to_lp_mode = {} + + _port_to_eeprom_mapping = {} + _port_to_i2c_mapping = { + 1: 17, + 2: 18, + 3: 19, + 4: 20, + 5: 21, + 6: 22, + 7: 23, + 8: 24, + 9: 25, + 10: 26, + 11: 27, + 12: 28, + 13: 29, + 14: 30, + 15: 31, + 16: 32, + 17: 33, + 18: 34, + 19: 35, + 20: 36, + 21: 37, + 22: 38, + 23: 39, + 24: 40, + 25: 41, + 26: 42, + 27: 43, + 28: 44, + 29: 45, + 30: 46, + 31: 47, + 32: 48, + 33: 49, + 34: 50, + } + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return list(range(self.PORT_START, self.PORTS_IN_BLOCK - 1)) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = self.BASE_OOM_PATH + "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] + ) + + SfpUtilBase.__init__(self) + + def __write_txt_file(self, file_path, value): + try: + reg_file = open(file_path, "w") + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + + reg_file.write(str(value)) + reg_file.close() + + return True + + def get_presence(self, port_num): + if port_num <= 16: + present_path = self.BASE_CPLD2_PATH + "module_present_" + str(port_num) + else: + present_path = self.BASE_CPLD3_PATH + "module_present_" + str(port_num) + self.__port_to_is_present = present_path + + try: + val_file = open(present_path) + content = val_file.readline().rstrip() + val_file.close() + except IOError as e: + print("Error: unable to access file: %s" % str(e)) + return False + + if content == "1": + return True + + return False + + def get_low_power_mode(self, port_num): + if port_num > self.QSFP_PORT_END: #sfp not support lpmode + return False + try: + eeprom = None + + if not self.get_presence(port_num): + return False + + eeprom = open(self.port_to_eeprom_mapping[port_num], "rb") + eeprom.seek(93) + lpmode = ord(eeprom.read(1)) + + if ((lpmode & 0x3) == 0x3): + return True # Low Power Mode if "Power override" bit is 1 and "Power set" bit is 1 + 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 + return 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) + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num > self.QSFP_PORT_END: #sfp not support lpmode: + return False + + try: + eeprom = None + if not self.get_presence(port_num): + return False # Port is not present, unable to set the eeprom + + # Fill in write buffer + # 0x3:Low Power Mode. "Power override" bit is 1 and "Power set" bit is 1 + # 0x9:High Power Mode. "Power override" bit is 1 ,"Power set" bit is 0 and "High Power Class Enable" bit is 1 + regval = 0x3 if lpmode else 0x9 + + buffer = create_string_buffer(1) + buffer[0] = regval + + # Write to eeprom + eeprom = open(self.port_to_eeprom_mapping[port_num], "r+b") + eeprom.seek(93) + eeprom.write(buffer[0]) + return True + 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) + + def reset(self, port_num): + if port_num > self.QSFP_PORT_END: #sfp not support lpmode: + return False + if not self.get_presence(port_num): + return False # Port is not present, unable to set reset + + if port_num < 16: + mod_rst_path = self.BASE_CPLD2_PATH + "module_reset_" + str(port_num) + else: + mod_rst_path = self.BASE_CPLD3_PATH + "module_reset_" + str(port_num) + + self.__port_to_mod_rst = mod_rst_path + + ret = self.__write_txt_file(self.__port_to_mod_rst, 1) + if ret is not True: + return ret + + time.sleep(0.2) + ret = self.__write_txt_file(self.__port_to_mod_rst, 0) + time.sleep(0.2) + + return ret + + def get_cpld_interrupt(self): + port_dict = {} + for i in range(0, 4): + if i == 0 or i == 1: + cpld_i2c_path = self.BASE_CPLD2_PATH + "cpld_intr_" + str(i+1) + else: + cpld_i2c_path = self.BASE_CPLD3_PATH + "cpld_intr_" + str(i+1) + + start_i = (i*8) + end_i = (i*8+8) + try: + val_file = open(cpld_i2c_path) + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + + for k in range(start_i, end_i): + port_dict[k] = 0 + return port_dict + + status = val_file.readline().rstrip() + val_file.close() + status = status.strip() + status = int(status, 16) + + interrupt_status = ~(status & 0xff) + if interrupt_status: + port_shift = 0 + for k in range(start_i, end_i): + if interrupt_status & (0x1 << port_shift): + port_dict[k] = 1 + else: + port_dict[k] = 0 + port_shift = port_shift+1 + + return port_dict + + def get_transceiver_change_event(self, timeout=0): + start_time = time.time() + 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 + + # for i in range(self.port_start, self.port_end+1): + # ori_present[i]=self.get_presence(i) + + while timeout >= 0: + change_status = 0 + + port_dict = self.get_cpld_interrupt() + present = 0 + for key, value in port_dict.items(): + if value == 1: + present = self.get_presence(key) + change_status = 1 + if present: + port_dict[key] = '1' + else: + port_dict[key] = '0' + + if change_status: + return True, 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, {} + print("get_evt_change_event: Should not reach here.") + return False, {} diff --git a/device/accton/x86_64-accton_as9726_32d-r0/pmon_daemon_control.json b/device/accton/x86_64-accton_as9726_32d-r0/pmon_daemon_control.json new file mode 100644 index 000000000000..584a14b9d942 --- /dev/null +++ b/device/accton/x86_64-accton_as9726_32d-r0/pmon_daemon_control.json @@ -0,0 +1,5 @@ +{ + "skip_ledd": true, + "skip_thermalctld": true +} + diff --git a/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/__init__.py b/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/__init__.py new file mode 100644 index 000000000000..a18a2a2d2a3b --- /dev/null +++ b/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/__init__.py @@ -0,0 +1,2 @@ +__all__ = ['chassis', 'eeprom', 'platform', 'psu', 'sfp', 'thermal', 'fan'] +from . import platform diff --git a/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/chassis.py b/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/chassis.py new file mode 100644 index 000000000000..7eb9601d8b56 --- /dev/null +++ b/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/chassis.py @@ -0,0 +1,201 @@ +############################################################################# +# Accton +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Chassis information which are available in the platform +# +############################################################################# + +import os + +try: + from sonic_platform_base.chassis_base import ChassisBase + from .helper import APIHelper +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +NUM_FAN_TRAY = 6 +NUM_FAN = 2 +NUM_PSU = 2 +NUM_THERMAL = 3 +NUM_QSFP = 32 +PORT_START = 1 +PORT_END = 34 +QSFP_PORT_START = 0 +QSFP_PORT_END = 31 +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 = "docker > /dev/null 2>&1" + + +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 + + self.QSFP_PORT_START = QSFP_PORT_START + self.QSFP_PORT_END = QSFP_PORT_END + for index in range(0, PORT_END): + if index in range(self.QSFP_PORT_START, self.QSFP_PORT_END + 1): + sfp_module = Sfp(index, 'QSFP') + else: + sfp_module = Sfp(index, 'SFP') + self._sfp_list.append(sfp_module) + 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) + + 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._api_helper.hwsku + + 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_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.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_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 diff --git a/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/component.py b/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/component.py new file mode 100644 index 000000000000..c34da704432a --- /dev/null +++ b/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/component.py @@ -0,0 +1,121 @@ +############################################################################# +# Accton +# +# 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 diff --git a/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/eeprom.py b/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/eeprom.py new file mode 100644 index 000000000000..7bf2bb58d19f --- /dev/null +++ b/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/eeprom.py @@ -0,0 +1,102 @@ +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' + + +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 get_eeprom(self): + return self._eeprom + + def get_serial(self): + return self._eeprom.get('0x23', "Undefined.") + + def get_mac(self): + return self._eeprom.get('0x24', "Undefined.") diff --git a/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/fan.py b/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/fan.py new file mode 100644 index 000000000000..a42bdba3bd7e --- /dev/null +++ b/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/fan.py @@ -0,0 +1,171 @@ +############################################################################# +# Accton +# +# 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 + +CPLD_I2C_PATH = "/sys/bus/i2c/devices/14-0066/fan_" +PSU_HWMON_I2C_PATH ="/sys/bus/i2c/devices/{}-00{}/" +PSU_I2C_MAPPING = { + 0: { + "num": 9, + "addr": "58" + }, + 1: { + "num": 9, + "addr": "59" + }, +} + + +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_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, 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_I2C_PATH, 'direction_', self.fan_tray_index) + val=self._api_helper.read_txt_file(dir_str) + if val is not None: + if val==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_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 False #Not supported + + 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 False #Not supported + + 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_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_presence(self): + """ + Retrieves the presence of the FAN + Returns: + bool: True if FAN is present, False if not + """ + present_path = "{}{}{}".format(CPLD_I2C_PATH, 'present_', self.fan_index+1) + 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 diff --git a/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/helper.py b/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/helper.py new file mode 100644 index 000000000000..4cd60ac90611 --- /dev/null +++ b/device/accton/x86_64-accton_as9726_32d-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') 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_as9726_32d-r0/sonic_platform/platform.py b/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/platform.py new file mode 100644 index 000000000000..b6bc56b5cc67 --- /dev/null +++ b/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/platform.py @@ -0,0 +1,21 @@ +############################################################################# +# Accton +# +# 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_as9726_32d-r0/sonic_platform/psu.py b/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/psu.py new file mode 100644 index 000000000000..0ccd83faf57d --- /dev/null +++ b/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/psu.py @@ -0,0 +1,226 @@ +############################################################################# +# Accton +# +# 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.fan import Fan + 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": 9, + "addr": "58" + }, + 1: { + "num": 9, + "addr": "59" + }, +} + +PSU_CPLD_I2C_MAPPING = { + 0: { + "num": 9, + "addr": "50" + }, + 1: { + "num": 9, + "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() + ''' + for fan_index in range(0, PSU_NUM_FAN[self.index]): + #def __init__(self, fan_tray_index, fan_index=0, is_psu_fan=False, psu_index=0): + #fan = Fan(fan_index, 0, is_psu_fan=True, psu_index=self.index) + fan = Fan(fan_index, 0, True, self.index) + self._fan_list.append(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 + """ + + return False #Controlled by HW + + 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 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 new file mode 100644 index 000000000000..70c6838a8e88 --- /dev/null +++ b/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/sfp.py @@ -0,0 +1,2221 @@ +############################################################################# +# Accton +# +# Sfp contains an implementation of SONiC Platform Base API and +# provides the sfp device status which are available in the platform +# +############################################################################# + +import os +import sys +import time +import struct + +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_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper + from .helper import APIHelper +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +#Edge-core definitions +CPLD2_I2C_PATH = "/sys/bus/i2c/devices/10-0061/" +CPLD3_I2C_PATH = "/sys/bus/i2c/devices/10-0062/" + +# 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 + +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 +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 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 + +# 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 = 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_MODULE_ADDRA2_OFFSET = 256 +SFP_MODULE_THRESHOLD_OFFSET = 0 +SFP_MODULE_THRESHOLD_WIDTH = 56 +SFP_CHANNL_THRESHOLD_OFFSET = 112 +SFP_CHANNL_THRESHOLD_WIDTH = 2 + +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 = 154 +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 + + +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' +) + +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' +] + +qsfp_cable_length_tup = ('Length(km)', 'Length OM3(2m)', + 'Length OM2(m)', 'Length OM1(m)', + 'Length Cable Assembly(m)') + +dom_info_dict_keys = [ + 'rx_los', 'tx_fault', 'reset_status', 'lp_mode', + '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'] + +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 +] + +SFP_TYPE = "SFP" +QSFP_TYPE = "QSFP" +OSFP_TYPE = "OSFP" +QSFP_DD_TYPE = "QSFP_DD" + +NULL_VAL = 'N/A' + +PORT_START = 1 +PORT_END = 34 +QSFP_PORT_START = 1 +QSFP_PORT_END = 32 + +SFP_I2C_START = 17 +I2C_EEPROM_PATH = '/sys/bus/i2c/devices/{0}-0050/eeprom' + + +class Sfp(SfpBase): + """Platform-specific Sfp class""" + HOST_CHK_CMD = "docker > /dev/null 2>&1" + PLATFORM = "x86_64-accton_as9726_32d-r0" + HWSKU = "Accton-AS9726-32D" + + # Path to sysfs + PLATFORM_ROOT_PATH = "/usr/share/sonic/device" + PMON_HWSKU_PATH = "/usr/share/sonic/hwsku" + + CPLD2_PORT_START = 1 + CPLD2_PORT_END = 16 + CPLD3_PORT_START = 17 + CPLD3_PORT_END = 32 + PRS_PATH = "/sys/devices/platform/dx010_cpld/qsfp_modprs" + + def __init__(self, sfp_index=0, sfp_name=None): + + self._index = sfp_index + self._port_num = self._index + 1 + self._api_helper = APIHelper() + self._name = sfp_name + + self._dom_capability_detect() + self._eeprom_path = self._get_eeprom_path() + SfpBase.__init__(self) + + def __write_txt_file(self, file_path, value): + try: + reg_file = open(file_path, "w") + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + + reg_file.write(str(value)) + reg_file.close() + + 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 _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_eeprom_specific_bytes(self, offset, num_bytes): + sysfs_sfp_i2c_client_eeprom_path = self._get_eeprom_path() + eeprom_raw = [] + try: + eeprom = open( + sysfs_sfp_i2c_client_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 _detect_sfp_type(self): + sfp_type = QSFP_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: + self.sfp_type = sfp_type + else: + self.sfp_type = sfp_type + + def _get_eeprom_path(self): + port_to_i2c_mapping = SFP_I2C_START + self._index + port_eeprom_path = I2C_EEPROM_PATH.format(port_to_i2c_mapping) + return port_eeprom_path + + def _dom_capability_detect(self): + self._detect_sfp_type() + + 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_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 + # currently set to False becasue Page 11h is not supported by FW + self.dom_rx_tx_power_bias_supported = False + 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 + 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( + info_dict_keys, NULL_VAL) + transceiver_info_dict["specification_compliance"] = '{}' + + # 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 transceiver_info_dict + + 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 transceiver_info_dict + + 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 transceiver_info_dict + + 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 transceiver_info_dict + + 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 transceiver_info_dict + + 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 transceiver_info_dict + + 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'] + + 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 transceiver_info_dict + + 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 transceiver_info_dict + + 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 transceiver_info_dict + + 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 transceiver_info_dict + + 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 transceiver_info_dict + + 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 transceiver_info_dict + + 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 transceiver_info_dict + + 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 transceiver_info_dict + + 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 transceiver_info_dict + + 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 transceiver_info_dict + + 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 transceiver_info_dict + + 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 transceiver_info_dict + + 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 transceiver_info_dict + + 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 transceiver_info_dict + 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 transceiver_info_dict + + 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 transceiver_info_dict + + 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 + + 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 transceiver_info_dict + + 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 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'] + + 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 = dict.fromkeys( + dom_info_dict_keys, NULL_VAL) + + 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 = 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 = 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'] = 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 self.dom_rx_power_supported: + 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 == 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 = 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 = 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 + dom_data_raw = self._read_eeprom_specific_bytes( + (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( + dom_channel_monitor_data['data']['TX1Power']['value']) + transceiver_dom_info_dict['tx2power'] = str( + dom_channel_monitor_data['data']['TX2Power']['value']) + transceiver_dom_info_dict['tx3power'] = str( + dom_channel_monitor_data['data']['TX3Power']['value']) + transceiver_dom_info_dict['tx4power'] = str( + dom_channel_monitor_data['data']['TX4Power']['value']) + transceiver_dom_info_dict['tx5power'] = str( + dom_channel_monitor_data['data']['TX5Power']['value']) + transceiver_dom_info_dict['tx6power'] = str( + dom_channel_monitor_data['data']['TX6Power']['value']) + transceiver_dom_info_dict['tx7power'] = str( + dom_channel_monitor_data['data']['TX7Power']['value']) + transceiver_dom_info_dict['tx8power'] = str( + dom_channel_monitor_data['data']['TX8Power']['value']) + + if self.dom_rx_power_supported: + transceiver_dom_info_dict['rx1power'] = str( + dom_channel_monitor_data['data']['RX1Power']['value']) + transceiver_dom_info_dict['rx2power'] = str( + dom_channel_monitor_data['data']['RX2Power']['value']) + transceiver_dom_info_dict['rx3power'] = str( + dom_channel_monitor_data['data']['RX3Power']['value']) + transceiver_dom_info_dict['rx4power'] = str( + dom_channel_monitor_data['data']['RX4Power']['value']) + transceiver_dom_info_dict['rx5power'] = str( + dom_channel_monitor_data['data']['RX5Power']['value']) + transceiver_dom_info_dict['rx6power'] = str( + dom_channel_monitor_data['data']['RX6Power']['value']) + transceiver_dom_info_dict['rx7power'] = str( + dom_channel_monitor_data['data']['RX7Power']['value']) + transceiver_dom_info_dict['rx8power'] = str( + 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'] = 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['tx1bias'] = dom_channel_monitor_data['data']['TXBias']['value'] + transceiver_dom_info_dict['tx1power'] = dom_channel_monitor_data['data']['TXPower']['value'] + + transceiver_dom_info_dict['lp_mode'] = self.get_lpmode() + transceiver_dom_info_dict['reset_status'] = self.get_reset_status() + transceiver_dom_info_dict['tx_disable'] = self.get_tx_disable() + transceiver_dom_info_dict['tx_disabled_channel'] = self.get_tx_disable_channel( + ) + + for key in transceiver_dom_info_dict: + val = transceiver_dom_info_dict[key] + transceiver_dom_info_dict[key] = self._convert_string_to_num( + val) if type(val) is str else val + + 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 = dict.fromkeys( + threshold_dict_keys, NULL_VAL) + + 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'] + + 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 + + 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 <= 16: + reset_path = "{}{}{}".format(CPLD2_I2C_PATH, '/module_reset_', self._port_num) + else: + reset_path = "{}{}{}".format(CPLD3_I2C_PATH, '/module_reset_', 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 = [] + + 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) + else: + return [False] * 4 + + elif self.sfp_type == QSFP_DD_TYPE: + # page 11h + if self.dom_rx_tx_power_bias_supported: + offset = 128 + 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: + return [False] * 8 + 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 [False] + 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_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) + else: + return [False] * 4 + elif self.sfp_type == QSFP_DD_TYPE: + # page 11h + if self.dom_rx_tx_power_bias_supported: + offset = 128 + 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: + return [False] * 8 + 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 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] + """ + 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) + else: + return [False] * 4 + + 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: + return [False] * 8 + 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 [False] + 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. + """ + 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 > 32: + # SFP doesn't support this feature + return False + else: + try: + eeprom = None + + if not self.get_presence(): + return False + # Write to eeprom + port_to_i2c_mapping = SFP_I2C_START + self._index + port_eeprom_path = I2C_EEPROM_PATH.format(port_to_i2c_mapping) + + eeprom = open(port_eeprom_path, "rb") + eeprom.seek(QSFP_POWEROVERRIDE_OFFSET) + lpmode = ord(eeprom.read(1)) + + if ((lpmode & 0x3) == 0x3): + return True # Low Power Mode if "Power override" bit is 1 and "Power set" bit is 1 + 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 + return 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) + + def get_power_set(self): + + if self._port_num > 32: + # 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_POWEROVERRIDE_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.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 False + else: + return NotImplementedError + + def get_temperature(self): + """ + Retrieves the temperature of this SFP + Returns: + An integer number of current temperature in Celsius + """ + default = 0.0 + if not self.dom_supported: + return default + + if self.sfp_type == QSFP_TYPE: + offset = 0 + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return default + + 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 + + elif self.sfp_type == QSFP_DD_TYPE: + offset = 0 + + sfpd_obj = qsfp_dd_Dom() + if sfpd_obj is None: + return default + + 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 + + else: + offset = 256 + sfpd_obj = sff8472Dom() + if sfpd_obj is None: + return default + 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 + + return default + + def get_voltage(self): + """ + Retrieves the supply voltage of this SFP + Returns: + An integer number of supply voltage in mV + """ + default = 0.0 + + if not self.dom_supported: + return default + + if self.sfp_type == QSFP_TYPE: + offset = 0 + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return default + + 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 + + if self.sfp_type == QSFP_DD_TYPE: + offset = 128 + + sfpd_obj = qsfp_dd_Dom() + if sfpd_obj is None: + return default + + 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 + + else: + offset = 256 + + sfpd_obj = sff8472Dom() + if sfpd_obj is None: + return default + + 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 + + return default + + 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 + default = [0.0] * 4 + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return default + + 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'])) + else: + return default + + elif self.sfp_type == QSFP_DD_TYPE: + default = [0.0] * 8 + # page 11h + if self.dom_rx_tx_power_bias_supported: + offset = 128 + sfpd_obj = qsfp_dd_Dom() + if sfpd_obj is None: + return default + + 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: + return default + else: + return default + + else: + offset = 256 + default = [0.0] + sfpd_obj = sff8472Dom() + if sfpd_obj is None: + return default + 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 default + else: + return default + + 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 + default = [0.0] * 4 + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return default + + 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 default + else: + return default + + elif self.sfp_type == QSFP_DD_TYPE: + default = [0.0] * 8 + # page 11 + if self.dom_rx_tx_power_bias_supported: + offset = 128 + sfpd_obj = qsfp_dd_Dom() + if sfpd_obj is None: + return default + + 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: + return default + else: + return default + + else: + offset = 256 + default = [0.0] + sfpd_obj = sff8472Dom() + if sfpd_obj is None: + return default + + 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 default + else: + return default + 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 tx_power_list + + elif self.sfp_type == QSFP_TYPE: + offset = 0 + default = [0.0] * 4 + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return tx_power_list + + 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 default + else: + return default + + elif self.sfp_type == QSFP_DD_TYPE: + default = [0.0] * 8 + + # page 11 + if self.dom_rx_tx_power_bias_supported: + offset = 128 + sfpd_obj = qsfp_dd_Dom() + if sfpd_obj is None: + return default + + 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: + return default + else: + return default + + else: + offset = 256 + default = [0.0] + sfpd_obj = sff8472Dom() + if sfpd_obj is None: + return default + + 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 default + else: + return default + return tx_power_list + + 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 > 32: + return False # SFP doesn't support this feature + else: + if not self.get_presence(): + return False + + if self._port_num <= self.CPLD2_PORT_END: + reset_path = "{}{}{}".format(CPLD2_I2C_PATH, 'module_reset_', self._port_num) + else: + reset_path = "{}{}{}".format(CPLD3_I2C_PATH, 'module_reset_', self._port_num) + + ret = self.__write_txt_file(reset_path, 1) #sysfs 1: enable reset + if ret is not True: + return ret + + time.sleep(0.2) + ret = self.__write_txt_file(reset_path, 0) #sysfs 0: disable reset + 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.sfp_type == QSFP_TYPE: + sysfsfile_eeprom = None + try: + tx_disable_value = 0xf if tx_disable else 0x0 + # Write to eeprom + sysfsfile_eeprom = open(self._eeprom_path, "r+b") + sysfsfile_eeprom.seek(QSFP_CONTROL_OFFSET) + sysfsfile_eeprom.write(struct.pack('B', tx_disable_value)) + except IOError: + return False + finally: + if sysfsfile_eeprom is not None: + sysfsfile_eeprom.close() + time.sleep(0.01) + return True + 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 + """ + if self.sfp_type == QSFP_TYPE: + sysfsfile_eeprom = None + try: + current_state = self.get_tx_disable_channel() + tx_disable_value = (current_state | channel) if \ + disable else (current_state & (~channel)) + + # Write to eeprom + sysfsfile_eeprom = open(self._eeprom_path, "r+b") + sysfsfile_eeprom.seek(QSFP_CONTROL_OFFSET) + sysfsfile_eeprom.write(struct.pack('B', tx_disable_value)) + except IOError: + return False + finally: + if sysfsfile_eeprom is not None: + sysfsfile_eeprom.close() + time.sleep(0.01) + return True + 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._port_num > 32: + return False # SFP doesn't support this feature + else: + if not self.get_presence(): + return False + + if lpmode is True: + self.set_power_override(True, True) + else: + self.set_power_override(True, 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 > 32: + 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 + port_to_i2c_mapping = SFP_I2C_START + self._index + port_eeprom_path = I2C_EEPROM_PATH.format(port_to_i2c_mapping) + with open(port_eeprom_path, "r+b") as fd: + fd.seek(QSFP_POWEROVERRIDE_OFFSET) + fd.write(buffer[0]) + time.sleep(0.01) + except Exception as e: + print ('Error: unable to open file: ', str(e)) + return False + return True + + ############################################################## + ###################### Device methods ######################## + ############################################################## + + 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 + """ + if self._port_num <= 16: + present_path = "{}{}{}".format(CPLD2_I2C_PATH, '/module_present_', self._port_num) + else: + present_path = "{}{}{}".format(CPLD3_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_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() + return transceiver_dom_info_dict.get("model", "N/A") + + 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() + return transceiver_dom_info_dict.get("serial", "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_presence() and not self.get_reset_status() + + def get_position_in_parent(self): + """ + Returns: + Temp return 0 + """ + return 0 + + def is_replaceable(self): + """ + Retrieves if replaceable + Returns: + A boolean value, True if replaceable + """ + return True diff --git a/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/thermal.py b/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/thermal.py new file mode 100644 index 000000000000..1a811719deaf --- /dev/null +++ b/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/thermal.py @@ -0,0 +1,151 @@ +############################################################################# +# Accton +# +# 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") + + +class Thermal(ThermalBase): + """Platform-specific Thermal class""" + + THERMAL_NAME_LIST = [] + SYSFS_PATH = "/sys/bus/i2c/devices" + + def __init__(self, thermal_index=0): + self.THERMAL_NAME_LIST = [] + self.SYSFS_PATH = "/sys/bus/i2c/devices" + 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.THERMAL_NAME_LIST.append("Temp sensor 5") + self.THERMAL_NAME_LIST.append("Temp sensor 6") + + # 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*/", + 4: "15-004c/hwmon/hwmon*/", + 5: "15-004f/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): + temp_file_path = os.path.join(self.hwmon_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): + 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 + """ + 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 + """ + 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 + """ + 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 + """ + 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 + """ + + 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 diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index e5b3bd7fef96..428fc4e22fd8 100644 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -35,6 +35,7 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(ACCTON_AS5812_54T_PLATFORM_MODULE) \ $(ACCTON_AS5835_54X_PLATFORM_MODULE) \ $(ACCTON_AS9716_32D_PLATFORM_MODULE) \ + $(ACCTON_AS9726_32D_PLATFORM_MODULE) \ $(ACCTON_AS5835_54T_PLATFORM_MODULE) \ $(ACCTON_AS7312_54XS_PLATFORM_MODULE) \ $(ACCTON_AS7315_27XB_PLATFORM_MODULE) \ diff --git a/platform/broadcom/platform-modules-accton.mk b/platform/broadcom/platform-modules-accton.mk index 3ccf2d675cbd..1e2bfdcf82de 100755 --- a/platform/broadcom/platform-modules-accton.mk +++ b/platform/broadcom/platform-modules-accton.mk @@ -16,6 +16,7 @@ ACCTON_AS5812_54X_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS5812_54T_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS5835_54X_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS9716_32D_PLATFORM_MODULE_VERSION = 1.1 +ACCTON_AS9726_32D_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS5835_54T_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS7312_54XS_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS7315_27XB_PLATFORM_MODULE_VERSION = 1.1 @@ -36,6 +37,7 @@ export ACCTON_AS5812_54X_PLATFORM_MODULE_VERSION export ACCTON_AS5812_54T_PLATFORM_MODULE_VERSION export ACCTON_AS5835_54X_PLATFORM_MODULE_VERSION export ACCTON_AS9716_32D_PLATFORM_MODULE_VERSION +export ACCTON_AS9726_32D_PLATFORM_MODULE_VERSION export ACCTON_AS5835_54T_PLATFORM_MODULE_VERSION export ACCTON_AS7312_54XS_PLATFORM_MODULE_VERSION export ACCTON_AS7315_27XB_PLATFORM_MODULE_VERSION @@ -110,6 +112,10 @@ ACCTON_AS9716_32D_PLATFORM_MODULE = sonic-platform-accton-as9716-32d_$(ACCTON_AS $(ACCTON_AS9716_32D_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as9716_32d-r0 $(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS9716_32D_PLATFORM_MODULE))) +ACCTON_AS9726_32D_PLATFORM_MODULE = sonic-platform-accton-as9726-32d_$(ACCTON_AS9726_32D_PLATFORM_MODULE_VERSION)_amd64.deb +$(ACCTON_AS9726_32D_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as9726_32d-r0 +$(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS9726_32D_PLATFORM_MODULE))) + ACCTON_AS5835_54T_PLATFORM_MODULE = sonic-platform-accton-as5835-54t_$(ACCTON_AS5835_54T_PLATFORM_MODULE_VERSION)_amd64.deb $(ACCTON_AS5835_54T_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as5835_54t-r0 $(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS5835_54T_PLATFORM_MODULE))) diff --git a/platform/broadcom/sonic-platform-modules-accton/as9726-32d/classes/__init__.py b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/classes/__init__.py new file mode 100755 index 000000000000..e69de29bb2d1 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 new file mode 100755 index 000000000000..1231b458801e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/classes/fanutil.py @@ -0,0 +1,216 @@ +#!/usr/bin/env python +# 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.) +# 04/06/2021:Michael_Shih craete for as9726_32d +# ------------------------------------------------------------------ + +try: + import logging +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + + +class FanUtil(object): + """Platform-specific FanUtil class""" + + FAN_NUM_ON_MAIN_BROAD = 6 + FAN_NUM_1_IDX = 1 + FAN_NUM_2_IDX = 2 + FAN_NUM_3_IDX = 3 + FAN_NUM_4_IDX = 4 + FAN_NUM_5_IDX = 5 + FAN_NUM_6_IDX = 6 + + FAN_NODE_NUM_OF_MAP = 2 + FAN_NODE_FAULT_IDX_OF_MAP = 1 + FAN_NODE_DIR_IDX_OF_MAP = 2 + + BASE_VAL_PATH = '/sys/bus/i2c/devices/14-0066/{0}' + FAN_DUTY_PATH = '/sys/bus/i2c/devices/14-0066/fan_duty_cycle_percentage' + + #logfile = '' + #loglevel = logging.INFO + + """ Dictionary where + key1 = fan id index (integer) starting from 1 + key2 = fan node index (interger) starting from 1 + value = path to fan device file (string) """ + _fan_device_path_mapping = {} + +#fan1_direction +#fan1_fault +#fan1_present + + #(FAN_NUM_2_IDX, FAN_NODE_DUTY_IDX_OF_MAP): 'fan2_duty_cycle_percentage', + _fan_device_node_mapping = { + (FAN_NUM_1_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan1_fault', + (FAN_NUM_1_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan1_direction', + + (FAN_NUM_2_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan2_fault', + (FAN_NUM_2_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan2_direction', + + (FAN_NUM_3_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan3_fault', + (FAN_NUM_3_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan3_direction', + + (FAN_NUM_4_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan4_fault', + (FAN_NUM_4_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan4_direction', + + (FAN_NUM_5_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan5_fault', + (FAN_NUM_5_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan5_direction', + + (FAN_NUM_6_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan6_fault', + (FAN_NUM_6_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan6_direction', + } + + def _get_fan_device_node(self, fan_num, node_num): + return self._fan_device_node_mapping[(fan_num, node_num)] + + def _get_fan_node_val(self, fan_num, node_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) + return None + + if node_num < self.FAN_NODE_FAULT_IDX_OF_MAP or node_num > self.FAN_NODE_NUM_OF_MAP: + logging.debug('GET. Parameter error. node_num:%d', node_num) + return None + + 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 IOError: + logging.debug('GET. unable to close file. device_path:%s', 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: + logging.debug('GET. Parameter error. fan_num:%d', fan_num) + return None + + if node_num < self.FAN_NODE_FAULT_IDX_OF_MAP or node_num > self.FAN_NODE_NUM_OF_MAP: + logging.debug('GET. Parameter error. node_num:%d', node_num) + return None + + content = str(val) + if content == '': + logging.debug('GET. content is NULL. device_path:%s', device_path) + return None + + device_path = self.get_fan_device_path(fan_num, node_num) + try: + val_file = open(device_path, 'w') + except IOError as e: + logging.error('GET. unable to open file: %s', str(e)) + return None + + val_file.write(content) + + try: + val_file.close() + except BaseException: + logging.debug('GET. unable to close file. device_path:%s', device_path) + return None + + return True + + def __init__(self): + fan_path = self.BASE_VAL_PATH + + for fan_num in range(self.FAN_NUM_1_IDX, self.FAN_NUM_ON_MAIN_BROAD+1): + for node_num in range(self.FAN_NODE_FAULT_IDX_OF_MAP, self.FAN_NODE_NUM_OF_MAP+1): + self._fan_device_path_mapping[(fan_num, node_num)] = fan_path.format( + self._fan_device_node_mapping[(fan_num, node_num)]) + + def get_num_fans(self): + return self.FAN_NUM_ON_MAIN_BROAD + + def get_idx_fan_start(self): + return self.FAN_NUM_1_IDX + + def get_num_nodes(self): + return self.FAN_NODE_NUM_OF_MAP + + def get_idx_node_start(self): + return self.FAN_NODE_FAULT_IDX_OF_MAP + + def get_size_node_map(self): + return len(self._fan_device_node_mapping) + + def get_size_path_map(self): + return len(self._fan_device_path_mapping) + + def get_fan_device_path(self, fan_num, node_num): + return self._fan_device_path_mapping[(fan_num, node_num)] + + def get_fan_fault(self, fan_num): + return self._get_fan_node_val(fan_num, self.FAN_NODE_FAULT_IDX_OF_MAP) + + def get_fan_dir(self, fan_num): + return self._get_fan_node_val(fan_num, self.FAN_NODE_DIR_IDX_OF_MAP) + + def get_fan_duty_cycle(self): + #duty_path = self.FAN_DUTY_PATH + try: + val_file = open(self.FAN_DUTY_PATH) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + val_file.close() + + return int(content) + + 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) + return False + + fan_file.write(str(val)) + fan_file.close() + return True + + def get_fanr_speed(self, fan_num): + return self._get_fan_node_val(fan_num, self.FANR_NODE_SPEED_IDX_OF_MAP) + + 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) + return None + + if self.get_fan_fault(fan_num) is not None and self.get_fan_fault(fan_num) > 0: + logging.debug('GET. FAN fault. fan_num, %d', fan_num) + return False + + return True diff --git a/platform/broadcom/sonic-platform-modules-accton/as9726-32d/classes/thermalutil.py b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/classes/thermalutil.py new file mode 100755 index 000000000000..1f00d72b8411 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/classes/thermalutil.py @@ -0,0 +1,89 @@ +#!/usr/bin/env python +# 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.) +# 04/06/2021: Michael_Shih craete for as9726_32d +# ------------------------------------------------------------------ + +try: + import logging + import glob +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + +class ThermalUtil(object): + """Platform-specific ThermalUtil class""" + THERMAL_NUM_MAX = 7 + THERMAL_NUM_1_IDX = 1 # 1~6 are mainboard thermal sensors + THERMAL_NUM_2_IDX = 2 + THERMAL_NUM_3_IDX = 3 + THERMAL_NUM_4_IDX = 4 + THERMAL_NUM_5_IDX = 5 + THERMAL_NUM_6_IDX = 6 # CPU core + THERMAL_NUM_7_IDX = 7 + + """ Dictionary where + key1 = thermal id index (integer) starting from 1 + value = path to fan device file (string) """ + #_thermal_to_device_path_mapping = {} + + thermal_sysfspath ={ + THERMAL_NUM_1_IDX: ["/sys/bus/i2c/devices/15-0048/hwmon/hwmon*/temp1_input"], + THERMAL_NUM_2_IDX: ["/sys/bus/i2c/devices/15-0049/hwmon/hwmon*/temp1_input"], + THERMAL_NUM_3_IDX: ["/sys/bus/i2c/devices/15-004a/hwmon/hwmon*/temp1_input"], + THERMAL_NUM_4_IDX: ["/sys/bus/i2c/devices/15-004c/hwmon/hwmon*/temp1_input"], + THERMAL_NUM_5_IDX: ["/sys/bus/i2c/devices/15-004f/hwmon/hwmon*/temp1_input"], + THERMAL_NUM_6_IDX: ["/sys/class/hwmon/hwmon0/temp1_input"], + THERMAL_NUM_7_IDX: ["/sys/bus/i2c/devices/15-004b/hwmon/hwmon*/temp1_input"], + } + + #def __init__(self): + + 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_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() + except BaseException: + logging.debug('GET. unable to close file. device_path:%s', device_path) + return None + + return int(content) + + return 0 + + def get_num_thermals(self): + return self.THERMAL_NUM_MAX + + def get_size_path_map(self): + return len(self.thermal_sysfspath) + + def get_thermal_path(self, thermal_num): + return self.thermal_sysfspath[thermal_num][0] diff --git a/platform/broadcom/sonic-platform-modules-accton/as9726-32d/modules/Makefile b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/modules/Makefile new file mode 100755 index 000000000000..d27e10b6d8de --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/modules/Makefile @@ -0,0 +1,19 @@ +ifneq ($(KERNELRELEASE),) +obj-m:= x86-64-accton-as9726-32d-cpld.o x86-64-accton-as9726-32d-psu.o \ + x86-64-accton-as9726-32d-fan.o ym2651y.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) +else +KERNELDIR:=$(KERNEL_SRC) +endif +PWD:=$(shell pwd) +default: + $(MAKE) -C $(KERNELDIR) M=$(PWD) modules +clean: + rm -rf *.o *.mod.o *.mod.o *.mod.c *.ko .*cmd .tmp_versions Module.markers Module.symvers modules.order +endif diff --git a/platform/broadcom/sonic-platform-modules-accton/as9726-32d/modules/x86-64-accton-as9726-32d-cpld.c b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/modules/x86-64-accton-as9726-32d-cpld.c new file mode 100755 index 000000000000..096d1384b650 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/modules/x86-64-accton-as9726-32d-cpld.c @@ -0,0 +1,987 @@ +/* + * Copyright (C) Brandon Chuang + * + * This module supports the accton cpld that hold the channel select + * mechanism for other i2c slave devices, such as SFP. + * This includes the: + * Accton as9726_32d CPU-CPLD/CPLD2/CPLD3 + * + * 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 + +#define I2C_RW_RETRY_COUNT 10 +#define I2C_RW_RETRY_INTERVAL 60 /* ms */ + +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_type { + as9726_32d_fpga, + as9726_32d_cpld2, + as9726_32d_cpld3, + as9726_32d_cpld_cpu +}; + +struct as9726_32d_cpld_data { + enum cpld_type type; + struct device *hwmon_dev; + struct mutex update_lock; +}; + +static const struct i2c_device_id as9726_32d_cpld_id[] = { + { "as9726_32d_fpga", as9726_32d_fpga }, + { "as9726_32d_cpld2", as9726_32d_cpld2 }, + { "as9726_32d_cpld3", as9726_32d_cpld3 }, + { "as9726_32d_cpld_cpu", as9726_32d_cpld_cpu }, + { } +}; +MODULE_DEVICE_TABLE(i2c, as9726_32d_cpld_id); + +#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_RESET_ATTR_ID(index) MODULE_RESET_##index +#define CPLD_INTR_ATTR_ID(index) CPLD_INTR_##index + +enum as9726_32d_cpld_sysfs_attributes { + CPLD_VERSION, + ACCESS, + /* 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_PRESENT_ATTR_ID(33), + TRANSCEIVER_PRESENT_ATTR_ID(34), + TRANSCEIVER_TXDISABLE_ATTR_ID(33), + TRANSCEIVER_TXDISABLE_ATTR_ID(34), + TRANSCEIVER_RXLOS_ATTR_ID(33), + TRANSCEIVER_RXLOS_ATTR_ID(34), + TRANSCEIVER_TXFAULT_ATTR_ID(33), + TRANSCEIVER_TXFAULT_ATTR_ID(34), + 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), + +}; + +/* sysfs attributes for hwmon + */ +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 set_tx_disable(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 ssize_t get_mode_reset(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t set_mode_reset(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static int as9726_32d_cpld_read_internal(struct i2c_client *client, u8 reg); +static int as9726_32d_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_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(index) \ + static SENSOR_DEVICE_ATTR(module_tx_disable_##index, S_IRUGO | S_IWUSR, show_status, set_tx_disable, MODULE_TXDISABLE_##index); \ + static SENSOR_DEVICE_ATTR(module_rx_los_##index, S_IRUGO, show_status, NULL, MODULE_RXLOS_##index); \ + static SENSOR_DEVICE_ATTR(module_tx_fault_##index, S_IRUGO, show_status, NULL, MODULE_RXLOS_##index); + +#define DECLARE_SFP_TRANSCEIVER_ATTR(index) \ + &sensor_dev_attr_module_tx_disable_##index.dev_attr.attr, \ + &sensor_dev_attr_module_rx_los_##index.dev_attr.attr, \ + &sensor_dev_attr_module_tx_fault_##index.dev_attr.attr + +/*reset*/ +#define DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(index) \ + static SENSOR_DEVICE_ATTR(module_reset_##index, S_IWUSR | S_IRUGO, get_mode_reset, set_mode_reset, MODULE_RESET_##index) +#define DECLARE_TRANSCEIVER_RESET_ATTR(index) &sensor_dev_attr_module_reset_##index.dev_attr.attr + +/*cpld interrupt*/ +#define DECLARE_CPLD_DEVICE_INTR_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 + + + +static SENSOR_DEVICE_ATTR(version, S_IRUGO, show_version, NULL, CPLD_VERSION); +static SENSOR_DEVICE_ATTR(access, S_IWUSR, NULL, access, ACCESS); +/* transceiver attributes */ +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_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(33); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(34); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(33); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(34); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(1); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(2); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(3); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(4); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(5); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(6); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(7); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(8); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(9); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(10); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(11); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(12); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(13); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(14); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(15); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(16); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(17); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(18); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(19); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(20); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(21); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(22); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(23); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(24); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(25); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(26); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(27); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(28); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(29); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(30); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(31); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(32); +DECLARE_CPLD_DEVICE_INTR_ATTR(1); +DECLARE_CPLD_DEVICE_INTR_ATTR(2); +DECLARE_CPLD_DEVICE_INTR_ATTR(3); +DECLARE_CPLD_DEVICE_INTR_ATTR(4); + + + +static struct attribute *as9726_32d_fpga_attributes[] = { + &sensor_dev_attr_version.dev_attr.attr, + &sensor_dev_attr_access.dev_attr.attr, + NULL +}; + +static const struct attribute_group as9726_32d_fpga_group = { + .attrs = as9726_32d_fpga_attributes, +}; + +static struct attribute *as9726_32d_cpld2_attributes[] = { + &sensor_dev_attr_version.dev_attr.attr, + &sensor_dev_attr_access.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_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_TRANSCEIVER_RESET_ATTR(1), + DECLARE_TRANSCEIVER_RESET_ATTR(2), + DECLARE_TRANSCEIVER_RESET_ATTR(3), + DECLARE_TRANSCEIVER_RESET_ATTR(4), + DECLARE_TRANSCEIVER_RESET_ATTR(5), + DECLARE_TRANSCEIVER_RESET_ATTR(6), + DECLARE_TRANSCEIVER_RESET_ATTR(7), + DECLARE_TRANSCEIVER_RESET_ATTR(8), + DECLARE_TRANSCEIVER_RESET_ATTR(9), + DECLARE_TRANSCEIVER_RESET_ATTR(10), + DECLARE_TRANSCEIVER_RESET_ATTR(11), + DECLARE_TRANSCEIVER_RESET_ATTR(12), + DECLARE_TRANSCEIVER_RESET_ATTR(13), + DECLARE_TRANSCEIVER_RESET_ATTR(14), + DECLARE_TRANSCEIVER_RESET_ATTR(15), + DECLARE_TRANSCEIVER_RESET_ATTR(16), + DECLARE_CPLD_INTR_ATTR(1), + DECLARE_CPLD_INTR_ATTR(2), + NULL +}; + +static const struct attribute_group as9726_32d_cpld2_group = { + .attrs = as9726_32d_cpld2_attributes, +}; + +static struct attribute *as9726_32d_cpld3_attributes[] = { + &sensor_dev_attr_version.dev_attr.attr, + &sensor_dev_attr_access.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_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_TRANSCEIVER_PRESENT_ATTR(33), + DECLARE_TRANSCEIVER_PRESENT_ATTR(34), + DECLARE_SFP_TRANSCEIVER_ATTR(33), + DECLARE_SFP_TRANSCEIVER_ATTR(34), + DECLARE_TRANSCEIVER_RESET_ATTR(17), + DECLARE_TRANSCEIVER_RESET_ATTR(18), + DECLARE_TRANSCEIVER_RESET_ATTR(19), + DECLARE_TRANSCEIVER_RESET_ATTR(20), + DECLARE_TRANSCEIVER_RESET_ATTR(21), + DECLARE_TRANSCEIVER_RESET_ATTR(22), + DECLARE_TRANSCEIVER_RESET_ATTR(23), + DECLARE_TRANSCEIVER_RESET_ATTR(24), + DECLARE_TRANSCEIVER_RESET_ATTR(25), + DECLARE_TRANSCEIVER_RESET_ATTR(26), + DECLARE_TRANSCEIVER_RESET_ATTR(27), + DECLARE_TRANSCEIVER_RESET_ATTR(28), + DECLARE_TRANSCEIVER_RESET_ATTR(29), + DECLARE_TRANSCEIVER_RESET_ATTR(30), + DECLARE_TRANSCEIVER_RESET_ATTR(31), + DECLARE_TRANSCEIVER_RESET_ATTR(32), + DECLARE_CPLD_INTR_ATTR(3), + DECLARE_CPLD_INTR_ATTR(4), + NULL +}; + +static const struct attribute_group as9726_32d_cpld3_group = { + .attrs = as9726_32d_cpld3_attributes, +}; + +static struct attribute *as9726_32d_cpld_cpu_attributes[] = { + &sensor_dev_attr_version.dev_attr.attr, + NULL +}; + +static const struct attribute_group as9726_32d_cpld_cpu_group = { + .attrs = as9726_32d_cpld_cpu_attributes, +}; + +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 as9726_32d_cpld_data *data = i2c_get_clientdata(client); + int status = 0; + u8 reg = 0; + + switch (attr->index) + { + case CPLD_INTR_1: + reg = 0x10; + break; + case CPLD_INTR_3: + reg = 0x10; + break; + case CPLD_INTR_2: + reg = 0x11; + break; + case CPLD_INTR_4: + reg = 0x11; + break; + default: + return -ENODEV; + } + mutex_lock(&data->update_lock); + status = as9726_32d_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 as9726_32d_cpld_data *data = i2c_get_clientdata(client); + int status = 0; + u8 reg = 0, mask = 0, revert = 0; + + switch (attr->index) { + case MODULE_PRESENT_1 ... MODULE_PRESENT_8: + reg = 0x12; + mask = 0x1 << (attr->index - MODULE_PRESENT_1); + break; + case MODULE_PRESENT_9 ... MODULE_PRESENT_16: + reg = 0x13; + mask = 0x1 << (attr->index - MODULE_PRESENT_9); + break; + case MODULE_PRESENT_17 ... MODULE_PRESENT_24: + reg = 0x12; + mask = 0x1 << (attr->index - MODULE_PRESENT_17); + break; + case MODULE_PRESENT_25 ... MODULE_PRESENT_32: + reg = 0x13; + mask = 0x1 << (attr->index - MODULE_PRESENT_25); + break; + case MODULE_PRESENT_33: + reg = 0x20; + mask = 0x1; + break; + case MODULE_PRESENT_34: + reg = 0x20; + mask = 0x2; + break; + case MODULE_RXLOS_33: + reg = 0x26; + mask = 0x1; + break; + case MODULE_RXLOS_34: + reg = 0x26; + mask = 0x2; + break; + case MODULE_TXDISABLE_33: + reg = 0x21; + mask = 0x1; + break; + case MODULE_TXDISABLE_34: + reg = 0x21; + mask = 0x2; + break; + + default: + return 0; + } + + if (attr->index >= MODULE_PRESENT_1 && attr->index <= MODULE_PRESENT_34) { + revert = 1; + } + + mutex_lock(&data->update_lock); + status = as9726_32d_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 set_tx_disable(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 as9726_32d_cpld_data *data = i2c_get_clientdata(client); + long disable; + int status; + u8 reg = 0, mask = 0; + + status = kstrtol(buf, 10, &disable); + if (status) { + return status; + } + + switch (attr->index) { + case MODULE_TXDISABLE_33: + reg = 0x21; + mask = 0x1; + break; + case MODULE_TXDISABLE_34: + reg = 0x21; + mask = 0x2; + break; + default: + return 0; + } + + /* Read current status */ + mutex_lock(&data->update_lock); + status = as9726_32d_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + + /* Update tx_disable status */ + if (disable) { + status |= mask; + } + else { + status &= ~mask; + } + + status = as9726_32d_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) +{ + int status; + u32 addr, val; + struct i2c_client *client = to_i2c_client(dev); + struct as9726_32d_cpld_data *data = i2c_get_clientdata(client); + + 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 = as9726_32d_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; +} + +static void as9726_32d_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 as9726_32d_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, 0x1); + + if (val < 0) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x1) err %d\n", client->addr, val); + } + + return sprintf(buf, "0x%x\n", val); +} + +static ssize_t get_mode_reset(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 as9726_32d_cpld_data *data = i2c_get_clientdata(client); + int status = 0; + u8 reg = 0, mask = 0; + + switch (attr->index) { + case MODULE_RESET_1 ... MODULE_RESET_8: + reg = 0x14; + mask = 0x1 << (attr->index - MODULE_RESET_1); + break; + case MODULE_RESET_9 ... MODULE_RESET_16: + reg = 0x15; + mask = 0x1 << (attr->index - MODULE_RESET_9); + break; + case MODULE_RESET_17 ... MODULE_RESET_24: + reg = 0x14; + mask = 0x1 << (attr->index - MODULE_RESET_17); + break; + case MODULE_RESET_25 ... MODULE_RESET_32: + reg = 0x15; + mask = 0x1 << (attr->index - MODULE_RESET_25); + break; + default: + return 0; + } + + + mutex_lock(&data->update_lock); + status = as9726_32d_cpld_read_internal(client, reg); + + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\r\n", !(status & mask)); + +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 as9726_32d_cpld_data *data = i2c_get_clientdata(client); + long reset; + int status=0, val, error; + u8 reg = 0, mask = 0; + + + error = kstrtol(buf, 10, &reset); + if (error) { + return error; + } + + switch (attr->index) { + case MODULE_RESET_1 ... MODULE_RESET_8: + reg = 0x14; + mask = 0x1 << (attr->index - MODULE_RESET_1); + break; + case MODULE_RESET_9 ... MODULE_RESET_16: + reg = 0x15; + mask = 0x1 << (attr->index - MODULE_RESET_9); + break; + case MODULE_RESET_17 ... MODULE_RESET_24: + reg = 0x14; + mask = 0x1 << (attr->index - MODULE_RESET_17); + break; + case MODULE_RESET_25 ... MODULE_RESET_32: + reg = 0x15; + mask = 0x1 << (attr->index - MODULE_RESET_25); + break; + default: + return 0; + } + mutex_lock(&data->update_lock); + + status = as9726_32d_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + + /* Update lp_mode status */ + if (reset) + { + val = status&(~mask); + } + else + { + val =status | (mask); + } + + status = as9726_32d_cpld_write_internal(client, reg, val); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; +} + + + +/* + * I2C init/probing/exit functions + */ +static int as9726_32d_cpld_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent); + struct as9726_32d_cpld_data *data; + int ret = -ENODEV; + int status; + const struct attribute_group *group = NULL; + + if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE)) + goto exit; + + data = kzalloc(sizeof(struct as9726_32d_cpld_data), GFP_KERNEL); + if (!data) { + ret = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + data->type = id->driver_data; + + + /* Register sysfs hooks */ + switch (data->type) { + case as9726_32d_fpga: + group = &as9726_32d_fpga_group; + break; + case as9726_32d_cpld2: + group = &as9726_32d_cpld2_group; + /*Set interrupt mask to 0, and then can get intr from 0x8*/ + status=as9726_32d_cpld_write_internal(client, 0x9, 0x0); + if (status < 0) + { + dev_dbg(&client->dev, "cpld2 reg 0x9 err %d\n", status); + } + break; + case as9726_32d_cpld3: + group = &as9726_32d_cpld3_group; + /*Set interrupt mask to 0, and then can get intr from 0x8*/ + status=as9726_32d_cpld_write_internal(client, 0x9, 0x0); + if (status < 0) + { + dev_dbg(&client->dev, "cpld3 reg 0x9 err %d\n", status); + } + break; + case as9726_32d_cpld_cpu: + group = &as9726_32d_cpld_cpu_group; + /* Disable CPLD reset to avoid DUT will be reset. + */ +// status=as9726_32d_cpld_write_internal(client, 0x3, 0x0); +// if (status < 0) +// { +// dev_dbg(&client->dev, "cpu_cpld reg 0x65 err %d\n", status); +// } + break; + default: + break; + } + + if (group) { + ret = sysfs_create_group(&client->dev.kobj, group); + if (ret) { + goto exit_free; + } + } + + as9726_32d_cpld_add_client(client); + return 0; + +exit_free: + kfree(data); +exit: + return ret; +} + +static int as9726_32d_cpld_remove(struct i2c_client *client) +{ + struct as9726_32d_cpld_data *data = i2c_get_clientdata(client); + const struct attribute_group *group = NULL; + + as9726_32d_cpld_remove_client(client); + + /* Remove sysfs hooks */ + switch (data->type) { + case as9726_32d_fpga: + group = &as9726_32d_fpga_group; + break; + case as9726_32d_cpld2: + group = &as9726_32d_cpld2_group; + break; + case as9726_32d_cpld3: + group = &as9726_32d_cpld3_group; + break; + case as9726_32d_cpld_cpu: + group = &as9726_32d_cpld_cpu_group; + break; + default: + break; + } + + if (group) { + sysfs_remove_group(&client->dev.kobj, group); + } + + kfree(data); + + return 0; +} + +static int as9726_32d_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; + } + + return status; +} + +static int as9726_32d_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; + } + + return status; +} + +int as9726_32d_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 = as9726_32d_cpld_read_internal(cpld_node->client, reg); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(as9726_32d_cpld_read); + +int as9726_32d_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 = as9726_32d_cpld_write_internal(cpld_node->client, reg, value); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(as9726_32d_cpld_write); + +static struct i2c_driver as9726_32d_cpld_driver = { + .driver = { + .name = "as9726_32d_cpld", + .owner = THIS_MODULE, + }, + .probe = as9726_32d_cpld_probe, + .remove = as9726_32d_cpld_remove, + .id_table = as9726_32d_cpld_id, +}; + +static int __init as9726_32d_cpld_init(void) +{ + mutex_init(&list_lock); + return i2c_add_driver(&as9726_32d_cpld_driver); +} + +static void __exit as9726_32d_cpld_exit(void) +{ + i2c_del_driver(&as9726_32d_cpld_driver); +} + +MODULE_AUTHOR("Michael Shih "); +MODULE_DESCRIPTION("Accton I2C CPLD driver"); +MODULE_LICENSE("GPL"); + +module_init(as9726_32d_cpld_init); +module_exit(as9726_32d_cpld_exit); + 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 new file mode 100755 index 000000000000..faf1e84acc37 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/modules/x86-64-accton-as9726-32d-fan.c @@ -0,0 +1,717 @@ +/* + * A hwmon driver for the Accton as9726 32d fan + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * 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 DRVNAME "as9726_32d_fan" + +static struct as9726_32d_fan_data *as9726_32d_fan_update_device(struct device *dev); +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); + +/* fan related data, the index should match sysfs_fan_attributes + */ +static const u8 fan_reg[] = { + 0x0F, /* fan 1-6 present status */ + 0x10, /* fan 1-6 direction(0:F2B 1:B2F) */ + 0x11, /* fan PWM(for all fan) */ + 0x12, /* front fan 1 speed(rpm) */ + 0x13, /* front fan 2 speed(rpm) */ + 0x14, /* front fan 3 speed(rpm) */ + 0x15, /* front fan 4 speed(rpm) */ + 0x16, /* front fan 5 speed(rpm) */ + 0x17, /* front fan 6 speed(rpm) */ + 0x22, /* rear fan 1 speed(rpm) */ + 0x23, /* rear fan 2 speed(rpm) */ + 0x24, /* rear fan 3 speed(rpm) */ + 0x25, /* rear fan 4 speed(rpm) */ + 0x26, /* rear fan 5 speed(rpm) */ + 0x27, /* rear fan 6 speed(rpm) */ +}; + +/* Each client has this additional data */ +struct as9726_32d_fan_data { + struct device *hwmon_dev; + struct mutex update_lock; + 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; +}; + +enum fan_id { + FAN1_ID, + FAN2_ID, + FAN3_ID, + FAN4_ID, + FAN5_ID, + FAN6_ID +}; + +enum sysfs_fan_attributes { + FAN_PRESENT_REG, + FAN_DIRECTION_REG, + FAN_DUTY_CYCLE_PERCENTAGE, /* Only one CPLD register to control duty cycle for all fans */ + FAN1_FRONT_SPEED_RPM, + FAN2_FRONT_SPEED_RPM, + FAN3_FRONT_SPEED_RPM, + FAN4_FRONT_SPEED_RPM, + FAN5_FRONT_SPEED_RPM, + FAN6_FRONT_SPEED_RPM, + FAN1_REAR_SPEED_RPM, + FAN2_REAR_SPEED_RPM, + FAN3_REAR_SPEED_RPM, + FAN4_REAR_SPEED_RPM, + FAN5_REAR_SPEED_RPM, + FAN6_REAR_SPEED_RPM, + FAN1_DIRECTION, + FAN2_DIRECTION, + FAN3_DIRECTION, + FAN4_DIRECTION, + FAN5_DIRECTION, + FAN6_DIRECTION, + FAN1_PRESENT, + FAN2_PRESENT, + FAN3_PRESENT, + FAN4_PRESENT, + FAN5_PRESENT, + FAN6_PRESENT, + FAN1_FAULT, + FAN2_FAULT, + FAN3_FAULT, + FAN4_FAULT, + FAN5_FAULT, + FAN6_FAULT +}; + +/* Define attributes + */ +#define DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_fault, S_IRUGO, fan_show_value, NULL, FAN##index##_FAULT) + +#define DECLARE_FAN_FAULT_ATTR(index) &sensor_dev_attr_fan##index##_fault.dev_attr.attr + +#define DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_direction, S_IRUGO, fan_show_value, NULL, FAN##index##_DIRECTION) + +#define DECLARE_FAN_DIRECTION_ATTR(index) &sensor_dev_attr_fan##index##_direction.dev_attr.attr + +#define DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(index) \ + 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_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 + +#define DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(index, index2) \ + static SENSOR_DEVICE_ATTR(fan##index##_front_speed_rpm, S_IRUGO, fan_show_value, NULL, FAN##index##_FRONT_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index##_rear_speed_rpm, S_IRUGO, fan_show_value, NULL, FAN##index##_REAR_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index##_input, S_IRUGO, fan_show_value, NULL, FAN##index##_FRONT_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index2##_input, S_IRUGO, fan_show_value, NULL, FAN##index##_REAR_SPEED_RPM) + +#define DECLARE_FAN_SPEED_RPM_ATTR(index, index2) &sensor_dev_attr_fan##index##_front_speed_rpm.dev_attr.attr, \ + &sensor_dev_attr_fan##index##_rear_speed_rpm.dev_attr.attr, \ + &sensor_dev_attr_fan##index##_input.dev_attr.attr, \ + &sensor_dev_attr_fan##index2##_input.dev_attr.attr + +/* 6 fan fault attributes in this platform */ +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(1); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(2); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(3); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(4); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(5); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(6); +/* 6 fan speed(rpm) attributes in this platform */ +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(1,11); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(2,12); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(3,13); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(4,14); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(5,15); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(6,16); +/* 6 fan present attributes in this platform */ +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(1); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(2); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(3); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(4); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(5); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(6); +/* 6 fan direction attribute in this platform */ +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(1); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(2); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(3); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(4); +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(); + +static struct attribute *as9726_32d_fan_attributes[] = { + /* fan related attributes */ + DECLARE_FAN_FAULT_ATTR(1), + DECLARE_FAN_FAULT_ATTR(2), + DECLARE_FAN_FAULT_ATTR(3), + DECLARE_FAN_FAULT_ATTR(4), + DECLARE_FAN_FAULT_ATTR(5), + DECLARE_FAN_FAULT_ATTR(6), + DECLARE_FAN_SPEED_RPM_ATTR(1,11), + DECLARE_FAN_SPEED_RPM_ATTR(2,12), + DECLARE_FAN_SPEED_RPM_ATTR(3,13), + DECLARE_FAN_SPEED_RPM_ATTR(4,14), + DECLARE_FAN_SPEED_RPM_ATTR(5,15), + DECLARE_FAN_SPEED_RPM_ATTR(6,16), + DECLARE_FAN_PRESENT_ATTR(1), + DECLARE_FAN_PRESENT_ATTR(2), + DECLARE_FAN_PRESENT_ATTR(3), + DECLARE_FAN_PRESENT_ATTR(4), + DECLARE_FAN_PRESENT_ATTR(5), + DECLARE_FAN_PRESENT_ATTR(6), + DECLARE_FAN_DIRECTION_ATTR(1), + DECLARE_FAN_DIRECTION_ATTR(2), + DECLARE_FAN_DIRECTION_ATTR(3), + DECLARE_FAN_DIRECTION_ATTR(4), + DECLARE_FAN_DIRECTION_ATTR(5), + DECLARE_FAN_DIRECTION_ATTR(6), + DECLARE_FAN_DUTY_CYCLE_ATTR(), + NULL +}; + +#define FAN_DUTY_CYCLE_REG_MASK 0xF +#define FAN_MAX_DUTY_CYCLE 100 +#define FAN_REG_VAL_TO_SPEED_RPM_STEP 200 + +static int as9726_32d_fan_read_value(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_byte_data(client, reg); +} + +static int as9726_32d_fan_write_value(struct i2c_client *client, u8 reg, u8 value) +{ + return i2c_smbus_write_byte_data(client, reg, value); +} + +/* fan utility functions + */ +static u32 reg_val_to_duty_cycle(u8 reg_val) +{ + reg_val &= FAN_DUTY_CYCLE_REG_MASK; + u32 duty_cycle = 0; + + switch(reg_val) + { + case 0: + duty_cycle = 0; + break; + case 5 ... 6: + duty_cycle = ( ((u32)(reg_val)+1) *6) + 1; + break; + case 7 ... 10: + duty_cycle = ( ((u32)(reg_val)+1) *6) + 2; + break; + case 11 ... 14: + duty_cycle = ( ((u32)(reg_val)+1) *6) + 3; + break; + case 15: + duty_cycle = 100; + break; + default: // 1~4 + duty_cycle = 31; + break; + } + + return duty_cycle; +} + +static u8 duty_cycle_to_reg_val(u8 duty_cycle) +{ + u32 reg_val = 0; + + if((u32)duty_cycle == 0) { + reg_val = 0; + } + else if((u32)duty_cycle <= 31) { + reg_val = 4; + } + else if((u32)duty_cycle <= 37) { + reg_val = 5; + } + else if((u32)duty_cycle <= 43) { + reg_val = 6; + } + else if((u32)duty_cycle <= 50) { + reg_val = 7; + } + else if((u32)duty_cycle <= 56) { + reg_val = 8; + } + else if((u32)duty_cycle <= 62) { + reg_val = 9; + } + else if((u32)duty_cycle <= 68) { + reg_val = 10; + } + else if((u32)duty_cycle <= 75) { + reg_val = 11; + } + else if((u32)duty_cycle <= 81) { + reg_val = 12; + } + else if((u32)duty_cycle <= 87) { + reg_val = 13; + } + else if((u32)duty_cycle <= 93) { + reg_val = 14; + } + else { + reg_val = 15; + } + + return reg_val; +} + +static u32 reg_val_to_speed_rpm(u8 reg_val) +{ + return (u32)reg_val * FAN_REG_VAL_TO_SPEED_RPM_STEP; +} + +static u8 reg_val_to_direction(u8 reg_val, enum fan_id id) +{ + u8 mask = (1 << id); + + reg_val &= mask; + + return reg_val ? 1 : 0; +} +static u8 reg_val_to_is_present(u8 reg_val, enum fan_id id) +{ + u8 mask = (1 << id); + + reg_val &= mask; + + return reg_val ? 0 : 1; +} + +static u8 is_fan_fault(struct as9726_32d_fan_data *data, enum fan_id id) +{ + u8 ret = 1; + int front_fan_index = FAN1_FRONT_SPEED_RPM + id; + int rear_fan_index = FAN1_REAR_SPEED_RPM + id; + + /* Check if the speed of front or rear fan is ZERO, + */ + if (reg_val_to_speed_rpm(data->reg_val[front_fan_index]) && + reg_val_to_speed_rpm(data->reg_val[rear_fan_index])) { + ret = 0; + } + + return ret; +} + +static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + int error, value; + struct i2c_client *client = to_i2c_client(dev); + + error = kstrtoint(buf, 10, &value); + if (error) + return error; + + if (value < 0 || value > FAN_MAX_DUTY_CYCLE) + return -EINVAL; + + as9726_32d_fan_write_value(client, 0x33, 0); /* Disable fan speed watch dog */ + as9726_32d_fan_write_value(client, fan_reg[FAN_DUTY_CYCLE_PERCENTAGE], duty_cycle_to_reg_val(value)); + 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) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct as9726_32d_fan_data *data = as9726_32d_fan_update_device(dev); + ssize_t ret = 0; + + if (data->valid) { + switch (attr->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: + ret = sprintf(buf, "%u\n", reg_val_to_speed_rpm(data->reg_val[attr->index])); + break; + case FAN1_PRESENT: + case FAN2_PRESENT: + case FAN3_PRESENT: + case FAN4_PRESENT: + case FAN5_PRESENT: + case FAN6_PRESENT: + ret = sprintf(buf, "%d\n", + reg_val_to_is_present(data->reg_val[FAN_PRESENT_REG], + attr->index - FAN1_PRESENT)); + break; + case FAN1_FAULT: + case FAN2_FAULT: + case FAN3_FAULT: + case FAN4_FAULT: + case FAN5_FAULT: + case FAN6_FAULT: + ret = sprintf(buf, "%d\n", is_fan_fault(data, attr->index - FAN1_FAULT)); + break; + case FAN1_DIRECTION: + case FAN2_DIRECTION: + case FAN3_DIRECTION: + case FAN4_DIRECTION: + case FAN5_DIRECTION: + case FAN6_DIRECTION: + ret = sprintf(buf, "%d\n", + reg_val_to_direction(data->reg_val[FAN_DIRECTION_REG], + attr->index - FAN1_DIRECTION)); + break; + default: + break; + } + } + + return ret; +} + +static const struct attribute_group as9726_32d_fan_group = { + .attrs = as9726_32d_fan_attributes, +}; + +static struct as9726_32d_fan_data *as9726_32d_fan_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as9726_32d_fan_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; + + dev_dbg(&client->dev, "Starting as9726_32d_fan update\n"); + data->valid = 0; + + /* Update fan data + */ + for (i = 0; i < ARRAY_SIZE(data->reg_val); i++) { + int status = as9726_32d_fan_read_value(client, fan_reg[i]); + if (status < 0) { + data->valid = 0; + mutex_unlock(&data->update_lock); + dev_dbg(&client->dev, "reg %d, err %d\n", fan_reg[i], status); + return data; + } + else { + data->reg_val[i] = status; + } + } + + data->last_updated = jiffies; + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; +} + +static int as9726_32d_fan_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as9726_32d_fan_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct as9726_32d_fan_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as9726_32d_fan_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: fan '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as9726_32d_fan_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as9726_32d_fan_remove(struct i2c_client *client) +{ + struct as9726_32d_fan_data *data = i2c_get_clientdata(client); + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as9726_32d_fan_group); + + return 0; +} + +/* Addresses to scan */ +static const unsigned short normal_i2c[] = { 0x66, I2C_CLIENT_END }; + +static const struct i2c_device_id as9726_32d_fan_id[] = { + { "as9726_32d_fan", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as9726_32d_fan_id); + +static struct i2c_driver as9726_32d_fan_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = DRVNAME, + }, + .probe = as9726_32d_fan_probe, + .remove = as9726_32d_fan_remove, + .id_table = as9726_32d_fan_id, + .address_list = normal_i2c, +}; + +module_i2c_driver(as9726_32d_fan_driver); + +MODULE_AUTHOR("Michael Shih "); +MODULE_DESCRIPTION("as9726_32d_fan driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as9726-32d/modules/x86-64-accton-as9726-32d-psu.c b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/modules/x86-64-accton-as9726-32d-psu.c new file mode 100755 index 000000000000..cdf11f503d6e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/modules/x86-64-accton-as9726-32d-psu.c @@ -0,0 +1,321 @@ +/* + * An hwmon driver for accton as9726_32d 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 +#include +#include + +#define MAX_MODEL_NAME 20 +#define MAX_SERIAL_NUMBER 19 + +static ssize_t show_status(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_string(struct device *dev, struct device_attribute *da, char *buf); +static int as9726_32d_psu_read_block(struct i2c_client *client, u8 command, u8 *data,int data_len); +extern int as9726_32d_cpld_read(unsigned short cpld_addr, u8 reg); + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { 0x50, 0x51, I2C_CLIENT_END }; + +/* Each client has this additional data + */ +struct as9726_32d_psu_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 index; /* PSU index */ + u8 status; /* Status(present/power_good) register read from CPLD */ + char model_name[MAX_MODEL_NAME]; /* Model name, read from eeprom */ + char serial_number[MAX_SERIAL_NUMBER]; +}; + +static struct as9726_32d_psu_data *as9726_32d_psu_update_device(struct device *dev); + +enum as9726_32d_psu_sysfs_attributes { + PSU_PRESENT, + PSU_MODEL_NAME, + PSU_POWER_GOOD, + PSU_SERIAL_NUMBER +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(psu_present, S_IRUGO, show_status, NULL, PSU_PRESENT); +static SENSOR_DEVICE_ATTR(psu_model_name, S_IRUGO, show_string, NULL, PSU_MODEL_NAME); +static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, show_status, NULL, PSU_POWER_GOOD); +static SENSOR_DEVICE_ATTR(psu_serial_number, S_IRUGO, show_string, NULL, PSU_SERIAL_NUMBER); + + +static struct attribute *as9726_32d_psu_attributes[] = { + &sensor_dev_attr_psu_present.dev_attr.attr, + &sensor_dev_attr_psu_model_name.dev_attr.attr, + &sensor_dev_attr_psu_power_good.dev_attr.attr, + &sensor_dev_attr_psu_serial_number.dev_attr.attr, + NULL +}; + +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 as9726_32d_psu_data *data = as9726_32d_psu_update_device(dev); + u8 status = 0; + + //printk("data->status=0x%x, attr->index=%d,data->index=%d \n", data->status, attr->index, data->index); + if (attr->index == PSU_PRESENT) { + if(data->index==0) + status = !( (data->status) & 0x1); + else + status = !( (data->status >> 1) & 0x1); + } + else { /* PSU_POWER_GOOD */ + if(data->index==0) + status = ( (data->status >> 2) & 0x1); + else + status = ( (data->status >> 3) & 0x1); + } + + return sprintf(buf, "%d\n", status); +} + +static ssize_t show_string(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct as9726_32d_psu_data *data = as9726_32d_psu_update_device(dev); + char *ptr = NULL; + + if (!data->valid) { + return -EIO; + } + + switch (attr->index) { + case PSU_MODEL_NAME: + ptr = data->model_name; + break; + case PSU_SERIAL_NUMBER: + ptr = data->serial_number; + break; + default: + return -EINVAL; + } + + return sprintf(buf, "%s\n", ptr); +} + +static const struct attribute_group as9726_32d_psu_group = { + .attrs = as9726_32d_psu_attributes, +}; + +static int as9726_32d_psu_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as9726_32d_psu_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct as9726_32d_psu_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + data->index = dev_id->driver_data; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as9726_32d_psu_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, &as9726_32d_psu_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as9726_32d_psu_remove(struct i2c_client *client) +{ + struct as9726_32d_psu_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as9726_32d_psu_group); + kfree(data); + + return 0; +} + +enum psu_index +{ + as9726_32d_psu1, + as9726_32d_psu2 +}; + +static const struct i2c_device_id as9726_32d_psu_id[] = { + { "as9726_32d_psu1", as9726_32d_psu1 }, + { "as9726_32d_psu2", as9726_32d_psu2 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as9726_32d_psu_id); + +static struct i2c_driver as9726_32d_psu_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "as9726_32d_psu", + }, + .probe = as9726_32d_psu_probe, + .remove = as9726_32d_psu_remove, + .id_table = as9726_32d_psu_id, + .address_list = normal_i2c, +}; + +static int as9726_32d_psu_read_block(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ + int result = 0; + int retry_count = 5; + + 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; +} + +static struct as9726_32d_psu_data *as9726_32d_psu_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as9726_32d_psu_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) + || !data->valid) { + int status; + int psu_present = 0; + + dev_dbg(&client->dev, "Starting as9726_32d update\n"); + + /* Read psu status */ + status = as9726_32d_cpld_read(0x60, 0x03); + //printk("status=0x%x in %s\n", status, __FUNCTION__); + + if (status < 0) { + dev_dbg(&client->dev, "cpld reg 0x60 err %d\n", status); + } + else { + data->status = status; + } + + /* Read model name */ + memset(data->model_name, 0, sizeof(data->model_name)); + memset(data->serial_number, 0, sizeof(data->serial_number)); + psu_present = (data->status >> (data->index) & 0x1); //0:present, 1:not present + + if (!psu_present) { + status = as9726_32d_psu_read_block(client, 0x20, data->model_name, + ARRAY_SIZE(data->model_name)-1); + if (status < 0) { + data->model_name[0] = '\0'; + dev_dbg(&client->dev, "unable to read model name from (0x%x)\n", client->addr); + printk("unable to read model name from (0x%x)\n", client->addr); + } + else { + data->model_name[ARRAY_SIZE(data->model_name)-1] = '\0'; + + } + /* Read from offset 0x35 ~ 0x46 (18 bytes) */ + status = as9726_32d_psu_read_block(client, 0x35,data->serial_number, MAX_SERIAL_NUMBER); + if (status < 0) + { + data->serial_number[0] = '\0'; + dev_dbg(&client->dev, "unable to read model name from (0x%x) offset(0x2e)\n", client->addr); + printk("unable to read model name from (0x%x) offset(0x2e)\n", client->addr); + } + data->serial_number[MAX_SERIAL_NUMBER-1]='\0'; + } + + data->last_updated = jiffies; + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; +} + +module_i2c_driver(as9726_32d_psu_driver); + +MODULE_AUTHOR("Michael Shih "); +MODULE_DESCRIPTION("as9726_32d_psu driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as9726-32d/modules/ym2651y.c b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/modules/ym2651y.c new file mode 100755 index 000000000000..63488d2c6c78 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/modules/ym2651y.c @@ -0,0 +1,678 @@ +/* + * An hwmon driver for the 3Y Power YM-2651Y 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 + +#define MAX_FAN_DUTY_CYCLE 100 + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { 0x58, 0x59, I2C_CLIENT_END }; + +enum chips { + YM2651, + YM2401, + YM2851, + YPEB1200AM, +}; + +/* Each client has this additional data + */ +struct ym2651y_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 chip; /* chip id */ + u8 capability; /* Register value */ + u16 status_word; /* Register value */ + u8 fan_fault; /* Register value */ + u8 over_temp; /* Register value */ + u16 v_out; /* Register value */ + u16 i_out; /* Register value */ + u16 p_out; /* Register value */ + u8 vout_mode; /* Register value */ + u16 temp; /* Register value */ + u16 fan_speed; /* Register value */ + u16 fan_duty_cycle[2]; /* Register value */ + u8 fan_dir[4]; /* Register value */ + u8 pmbus_revision; /* Register value */ + u8 mfr_id[10]; /* Register value */ + u8 mfr_model[10]; /* Register value */ + u8 mfr_revsion[3]; /* Register value */ + u16 mfr_vin_min; /* Register value */ + u16 mfr_vin_max; /* Register value */ + u16 mfr_iin_max; /* Register value */ + u16 mfr_iout_max; /* Register value */ + u16 mfr_pin_max; /* Register value */ + u16 mfr_pout_max; /* Register value */ + u16 mfr_vout_min; /* Register value */ + u16 mfr_vout_max; /* Register value */ +}; + +static ssize_t show_vout(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_byte(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_word(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_fan_fault(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_over_temp(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 ym2651y_data *ym2651y_update_device(struct device *dev); +static ssize_t set_fan_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static int ym2651y_write_word(struct i2c_client *client, u8 reg, u16 value); + +enum ym2651y_sysfs_attributes { + PSU_POWER_ON = 0, + PSU_TEMP_FAULT, + PSU_POWER_GOOD, + PSU_FAN1_FAULT, + PSU_FAN_DIRECTION, + PSU_OVER_TEMP, + PSU_V_OUT, + PSU_I_OUT, + PSU_P_OUT, + PSU_P_OUT_UV, /*In Unit of microVolt, instead of mini.*/ + PSU_TEMP1_INPUT, + PSU_FAN1_SPEED, + PSU_FAN1_DUTY_CYCLE, + PSU_PMBUS_REVISION, + PSU_MFR_ID, + PSU_MFR_MODEL, + PSU_MFR_REVISION, + PSU_MFR_VIN_MIN, + PSU_MFR_VIN_MAX, + PSU_MFR_VOUT_MIN, + PSU_MFR_VOUT_MAX, + PSU_MFR_IIN_MAX, + PSU_MFR_IOUT_MAX, + PSU_MFR_PIN_MAX, + PSU_MFR_POUT_MAX +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(psu_power_on, S_IRUGO, show_word, NULL, PSU_POWER_ON); +static SENSOR_DEVICE_ATTR(psu_temp_fault, S_IRUGO, show_word, NULL, PSU_TEMP_FAULT); +static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, show_word, NULL, PSU_POWER_GOOD); +static SENSOR_DEVICE_ATTR(psu_fan1_fault, S_IRUGO, show_fan_fault, NULL, PSU_FAN1_FAULT); +static SENSOR_DEVICE_ATTR(psu_over_temp, S_IRUGO, show_over_temp, NULL, PSU_OVER_TEMP); +static SENSOR_DEVICE_ATTR(psu_v_out, S_IRUGO, show_vout, NULL, PSU_V_OUT); +static SENSOR_DEVICE_ATTR(psu_i_out, S_IRUGO, show_linear, NULL, PSU_I_OUT); +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_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_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_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); +static SENSOR_DEVICE_ATTR(psu_mfr_vout_max, S_IRUGO, show_linear, NULL, PSU_MFR_VOUT_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_iin_max, S_IRUGO, show_linear, NULL, PSU_MFR_IIN_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_iout_max, S_IRUGO, show_linear, NULL, PSU_MFR_IOUT_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_pin_max, S_IRUGO, show_linear, NULL, PSU_MFR_PIN_MAX); +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, 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_UV); +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 SENSOR_DEVICE_ATTR(temp1_fault, S_IRUGO, show_word, NULL, PSU_TEMP_FAULT); + +static struct attribute *ym2651y_attributes[] = { + &sensor_dev_attr_psu_power_on.dev_attr.attr, + &sensor_dev_attr_psu_temp_fault.dev_attr.attr, + &sensor_dev_attr_psu_power_good.dev_attr.attr, + &sensor_dev_attr_psu_fan1_fault.dev_attr.attr, + &sensor_dev_attr_psu_over_temp.dev_attr.attr, + &sensor_dev_attr_psu_v_out.dev_attr.attr, + &sensor_dev_attr_psu_i_out.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_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_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_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, + &sensor_dev_attr_psu_mfr_iin_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_pin_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_vout_min.dev_attr.attr, + &sensor_dev_attr_psu_mfr_vout_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_iout_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, + &sensor_dev_attr_temp1_fault.dev_attr.attr, + NULL +}; + +static ssize_t show_byte(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct ym2651y_data *data = ym2651y_update_device(dev); + + return (attr->index == PSU_PMBUS_REVISION) ? sprintf(buf, "%d\n", data->pmbus_revision) : + sprintf(buf, "0\n"); +} + +static ssize_t show_word(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct ym2651y_data *data = ym2651y_update_device(dev); + u16 status = 0; + + switch (attr->index) { + case PSU_POWER_ON: /* psu_power_on, low byte bit 6 of status_word, 0=>ON, 1=>OFF */ + status = (data->status_word & 0x40) ? 0 : 1; + break; + case PSU_TEMP_FAULT: /* psu_temp_fault, low byte bit 2 of status_word, 0=>Normal, 1=>temp fault */ + status = (data->status_word & 0x4) >> 2; + break; + case PSU_POWER_GOOD: /* psu_power_good, high byte bit 3 of status_word, 0=>OK, 1=>FAIL */ + status = (data->status_word & 0x800) ? 0 : 1; + break; + } + + return sprintf(buf, "%d\n", status); +} + +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 set_fan_duty_cycle(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 ym2651y_data *data = i2c_get_clientdata(client); + int nr = (attr->index == PSU_FAN1_DUTY_CYCLE) ? 0 : 1; + long speed; + int error; + + error = kstrtol(buf, 10, &speed); + if (error) + return error; + + if (speed < 0 || speed > MAX_FAN_DUTY_CYCLE) + return -EINVAL; + + mutex_lock(&data->update_lock); + data->fan_duty_cycle[nr] = speed; + ym2651y_write_word(client, 0x3B + nr, data->fan_duty_cycle[nr]); + mutex_unlock(&data->update_lock); + + return count; +} + +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 ym2651y_data *data = ym2651y_update_device(dev); + + u16 value = 0; + int exponent, mantissa; + int multiplier = 1000; + + switch (attr->index) { + case PSU_V_OUT: + value = data->v_out; + break; + case PSU_I_OUT: + value = data->i_out; + break; + case PSU_P_OUT_UV: + multiplier = 1000000; /*For lm-sensors, unit is micro-Volt.*/ + /*Passing through*/ + case PSU_P_OUT: + value = data->p_out; + break; + case PSU_TEMP1_INPUT: + value = data->temp; + break; + case PSU_FAN1_SPEED: + value = data->fan_speed; + multiplier = 1; + break; + case PSU_FAN1_DUTY_CYCLE: + value = data->fan_duty_cycle[0]; + multiplier = 1; + break; + case PSU_MFR_VIN_MIN: + value = data->mfr_vin_min; + break; + case PSU_MFR_VIN_MAX: + value = data->mfr_vin_max; + break; + case PSU_MFR_VOUT_MIN: + value = data->mfr_vout_min; + break; + case PSU_MFR_VOUT_MAX: + value = data->mfr_vout_max; + break; + case PSU_MFR_PIN_MAX: + value = data->mfr_pin_max; + break; + case PSU_MFR_POUT_MAX: + value = data->mfr_pout_max; + break; + case PSU_MFR_IOUT_MAX: + value = data->mfr_iout_max; + break; + case PSU_MFR_IIN_MAX: + value = data->mfr_iin_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_fan_fault(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct ym2651y_data *data = ym2651y_update_device(dev); + + u8 shift = (attr->index == PSU_FAN1_FAULT) ? 7 : 6; + + return sprintf(buf, "%d\n", data->fan_fault >> shift); +} + +static ssize_t show_over_temp(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct ym2651y_data *data = ym2651y_update_device(dev); + + return sprintf(buf, "%d\n", data->over_temp >> 7); +} + +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 ym2651y_data *data = ym2651y_update_device(dev); + u8 *ptr = NULL; + + switch (attr->index) { + case PSU_FAN_DIRECTION: /* psu_fan_dir */ + if (data->chip==YPEB1200AM) + { + memcpy(data->fan_dir, "F2B", 3); + data->fan_dir[3]='\0'; + } + ptr = data->fan_dir; + break; + case PSU_MFR_ID: /* psu_mfr_id */ + ptr = data->mfr_id; + break; + case PSU_MFR_MODEL: /* psu_mfr_model */ + ptr = data->mfr_model; + break; + case PSU_MFR_REVISION: /* psu_mfr_revision */ + ptr = data->mfr_revsion; + 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 ym2651y_data *data = ym2651y_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_MFR_VOUT_MIN: + mantissa = data->mfr_vout_min; + break; + case PSU_MFR_VOUT_MAX: + mantissa = data->mfr_vout_max; + break; + 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 ssize_t show_vout(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct ym2651y_data *data = i2c_get_clientdata(client); + u8 *ptr = NULL; + + ptr = data->mfr_model + 1; /* The first byte is the count byte of string. */ + if (data->chip == YM2401) { + return show_vout_by_mode(dev, da, buf); + } + else { + return show_linear(dev, da, buf); + } +} + +static const struct attribute_group ym2651y_group = { + .attrs = ym2651y_attributes, +}; + +static int ym2651y_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct ym2651y_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 ym2651y_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + data->chip = dev_id->driver_data; + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &ym2651y_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, &ym2651y_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int ym2651y_remove(struct i2c_client *client) +{ + struct ym2651y_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &ym2651y_group); + kfree(data); + + return 0; +} + +static const struct i2c_device_id ym2651y_id[] = { + { "ym2651", YM2651 }, + { "ym2401", YM2401 }, + { "ym2851", YM2851 }, + { "ype1200am", YPEB1200AM }, + {} +}; +MODULE_DEVICE_TABLE(i2c, ym2651y_id); + +static struct i2c_driver ym2651y_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "ym2651", + }, + .probe = ym2651y_probe, + .remove = ym2651y_remove, + .id_table = ym2651y_id, + .address_list = normal_i2c, +}; + +static int ym2651y_read_byte(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_byte_data(client, reg); +} + +static int ym2651y_read_word(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_word_data(client, reg); +} + +static int ym2651y_write_word(struct i2c_client *client, u8 reg, u16 value) +{ + return i2c_smbus_write_word_data(client, reg, value); +} + +static int ym2651y_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 ym2651y_data *ym2651y_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct ym2651y_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; + u8 fan_dir[5] = {0}; + struct reg_data_byte regs_byte[] = { {0x19, &data->capability}, + {0x20, &data->vout_mode}, + {0x7d, &data->over_temp}, + {0x81, &data->fan_fault}, + {0x98, &data->pmbus_revision} + }; + struct reg_data_word regs_word[] = { {0x79, &data->status_word}, + {0x8b, &data->v_out}, + {0x8c, &data->i_out}, + {0x96, &data->p_out}, + {0x8d, &data->temp}, + {0x3b, &(data->fan_duty_cycle[0])}, + {0x3c, &(data->fan_duty_cycle[1])}, + {0x90, &data->fan_speed}, + {0xa0, &data->mfr_vin_min}, + {0xa1, &data->mfr_vin_max}, + {0xa2, &data->mfr_iin_max}, + {0xa3, &data->mfr_pin_max}, + {0xa4, &data->mfr_vout_min}, + {0xa5, &data->mfr_vout_max}, + {0xa6, &data->mfr_iout_max}, + {0xa7, &data->mfr_pout_max} + }; + + dev_dbg(&client->dev, "Starting ym2651 update\n"); + + /* Read byte data */ + for (i = 0; i < ARRAY_SIZE(regs_byte); i++) { + status = ym2651y_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 = ym2651y_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 fan_direction */ + command = 0xC3; + status = ym2651y_read_block(client, command, fan_dir, ARRAY_SIZE(fan_dir)-1); + + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + } + + strncpy(data->fan_dir, fan_dir+1, ARRAY_SIZE(data->fan_dir)-1); + data->fan_dir[ARRAY_SIZE(data->fan_dir)-1] = '\0'; + + /* Read mfr_id */ + command = 0x99; + status = ym2651y_read_block(client, command, data->mfr_id, + ARRAY_SIZE(data->mfr_id)-1); + data->mfr_id[ARRAY_SIZE(data->mfr_id)-1] = '\0'; + + if (status < 0) + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + + /* 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'; + + if (status < 0) + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + + /* Read mfr_revsion */ + command = 0x9b; + status = ym2651y_read_block(client, command, data->mfr_revsion, + ARRAY_SIZE(data->mfr_revsion)-1); + data->mfr_revsion[ARRAY_SIZE(data->mfr_revsion)-1] = '\0'; + + 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(ym2651y_driver); + +MODULE_AUTHOR("Michael Shih "); +MODULE_DESCRIPTION("3Y Power YM-2651Y driver"); +MODULE_LICENSE("GPL"); + + diff --git a/platform/broadcom/sonic-platform-modules-accton/as9726-32d/service/as9726-32d-platform-monitor-fan.service b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/service/as9726-32d-platform-monitor-fan.service new file mode 100644 index 000000000000..ac0114c8f507 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/service/as9726-32d-platform-monitor-fan.service @@ -0,0 +1,16 @@ +[Unit] +Description=Accton AS9726_32D Platform Monitoring FAN service +Before=pmon.service +After=as9726-32d-platform-monitor.service +DefaultDependencies=no + +[Service] +ExecStart=/usr/local/bin/accton_as9726_32d_monitor_fan.py +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as9726-32d/service/as9726-32d-platform-monitor-psu.service b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/service/as9726-32d-platform-monitor-psu.service new file mode 100644 index 000000000000..916219c9f7de --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/service/as9726-32d-platform-monitor-psu.service @@ -0,0 +1,16 @@ +[Unit] +Description=Accton AS9726_32D Platform Monitoring PSU service +Before=pmon.service +After=as9726-32d-platform-monitor.service +DefaultDependencies=no + +[Service] +ExecStart=/usr/local/bin/accton_as9726_32d_monitor_psu.py +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as9726-32d/service/as9726-32d-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/service/as9726-32d-platform-monitor.service new file mode 100644 index 000000000000..072a8227e7e9 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/service/as9726-32d-platform-monitor.service @@ -0,0 +1,17 @@ +[Unit] +Description=Accton AS9726_32D Platform Monitoring service +Before=pmon.service +After=sysinit.target +DefaultDependencies=no + +[Service] +ExecStartPre=/usr/local/bin/accton_as9726_32d_util.py install +ExecStart=/usr/local/bin/accton_as9726_32d_monitor.py +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as9726-32d/setup.py b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/setup.py new file mode 100755 index 000000000000..7b84a9cab7ec --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/setup.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python + +import os +from setuptools import setup +os.listdir + +setup( + name='as9726_32d', + version='1.0', + description='Module to initialize Accton AS9726_32D platforms', + + packages=['as9726_32d'], + package_dir={'as9726_32d': 'as9726-32d/classes'}, +) diff --git a/platform/broadcom/sonic-platform-modules-accton/as9726-32d/sonic_platform_setup.py b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/sonic_platform_setup.py new file mode 100644 index 000000000000..474094b28dcb --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/sonic_platform_setup.py @@ -0,0 +1,34 @@ +from setuptools import setup + +DEVICE_NAME = 'accton' +HW_SKU = 'x86_64-accton_as9726_32d-r0' + +setup( + name='sonic-platform', + version='1.0', + description='SONiC platform API implementation on Accton Platforms', + license='Apache 2.0', + author='SONiC Team', + author_email='linuxnetdev@microsoft.com', + url='https://github.com/Azure/sonic-buildimage', + maintainer='Michael Shih', + maintainer_email='michael_shih@edge-core.com', + packages=[ + 'sonic_platform', + ], + package_dir={ + 'sonic_platform': '../../../../device/{}/{}/sonic_platform'.format(DEVICE_NAME, HW_SKU)}, + 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/as9726-32d/utils/README b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/utils/README new file mode 100755 index 000000000000..16efca9ef848 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/utils/README @@ -0,0 +1,65 @@ +Copyright (C) 2019 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 . + +All Linux kernel code is licensed under the GPLv1. All other code is +licensed under the GPLv3. Please see the LICENSE file for copies of +both licenses. + +The code for integacting with Accton AS9726-32D has 2 parts, +kernel drivers and operational script. +The kernel drivers of peripherals are under module/ directory. +1. These drivers are at module dir. +2. A operational script, accton_as9726_32d_util.py, for device initializatian and + peripheral accessing should be installed at /usr/bin. + Run "accton_as9726_32d_util.py install" to install drivers. + +To initialize the system, run "accton_as9726_32d_util.py install". +To clean up the drivers & devices, run "accton_as9726_32d_util.py clean". +To dump information of sensors, run "accton_as9726_32d_util.py show". +To dump SFP EEPROM, run "accton_as9726_32d_util.py sff". +To set fan speed, run "accton_as9726_32d_util.py set fan". +To enable/disable SFP emission, run "accton_as9726_32d_util.py set sfp". +To set system LEDs' color, run "accton_as9726_32d_util.py set led" +For more information, run "accton_as9726_32d_util.py --help". + +==================================================================== +Besides applying accton_as9726_32d_util.py to access peripherals, you can +access peripherals by sysfs nodes directly after the installation is run. + +System LED: + There are 5 system LEDs at the lower-left corner of front panel. + They are loc, diag, psu1, psu2 and fan. + The sysfs interface color mappings are as follows: + Brightness: + 0 => off + 1 => green + 2 => amber + But not all colors are available for each LED. + +Fan Control: + There are 12 fans inside 6 fan modules. + All fans share 1 duty setting, ranged from 0~100. + +Thermal sensers: + 6 temperature sensors are controlled by the lm75 kernel modules. + +PSUs: + There 2 power supplies slot at the left/right side of the back. + Once if a PSU is not plugged, the status of it is shown failed. + +There are 32 QSFP56-DD and 2 SFP+ modules are equipped. +Before operating on PSU and QSFP+, please make sure it is well plugged. +Otherwise, operation is going to fail. + 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 new file mode 100755 index 000000000000..9d91e942baa2 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/utils/accton_as9726_32d_monitor.py @@ -0,0 +1,565 @@ +#!/usr/bin/env python +# -*- 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.)# +# 04/23/2021: Michael_Shih create for as9726_32d thermal plan +# ------------------------------------------------------------------ + +try: + import commands + import getopt + import sys + import logging + import logging.config + import logging.handlers + import time # this is only being used as part of the example + from as9726_32d.fanutil import FanUtil + from as9726_32d.thermalutil import ThermalUtil +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + +# Deafults +VERSION = '1.0' +FUNCTION_NAME = '/usr/local/bin/accton_as9726_32d_monitor' + +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 + + + +# Read fanN_direction=1: The air flow of Fan6 is “AFI-Back to Front” +# 0: The air flow of Fan6 is “AFO-Front to back” +# +# Thermal policy: +# a.Defaut fan duty_cycle=100% +# b.One fan fail, set to fan duty_cycle=100% +# 1.For AFI: +# Default fan duty_cycle will be 100%(fan_policy_state=LEVEL_FAN_MAX). +# If all below case meet with, set to 75%(LEVEL_FAN_MID). +# MB board +# (MB board) +# LM75-1(0X48)>=49.5 +# LM75-2(0X49)>=42.9 +# LM75-3(0X4A)>=46.3 +# LM75-4(0X4C)>=40.1 +# LM75-6(0X4F)>=39.4 +# (CPU board) +# Core>=46 +# LM75-1(0X4B)>=34.8 + +# When fan_policy_state=LEVEL_FAN_MID, meet with below case, Fan duty_cycle will be 100%(LEVEL_FAN_DAX) +# (MB board) +# LM75-1(0X48)>=55.9 +# LM75-2(0X49)>=48.8 +# LM75-3(0X4A)>=51.5 +# LM75-4(0X4C)>=45.3 +# LM75-6(0X4F)>=43.4 +# (CPU board) +# Core>=50 +# LM75-1(0X4B)>=43.4 + +#Yellow Alarm +#MB board +#LM75-1(0X48)>=57.9 +#LM75-2(0X49)>=51.9 +#LM75-3(0X4A)>=48.9 +#LM75-4(0X4C)>=55.9 +#LM75-6(0X4F)>=48.5 +#CPU Board +#Core>=52 +#LM75-1(0X4B)>=41.8 + +#Red Alarm +#MB board +#LM75-1(0X48)>=62.9 +#LM75-2(0X49)>=56.9 +#LM75-3(0X4A)>=53.9 +#LM75-4(0X4C)>=58.9 +#LM75-6(0X4F)>=53.5 +#CPU Board +#Core>=57 +#LM75-1(0X4B)>=46.8 + +#Shut down +#MB board +#LM75-1(0X48)>=67.9 +#LM75-2(0X49)>=61.9 +#LM75-3(0X4A)>=58.9 +#LM75-4(0X4C)>=63.9 +#LM75-6(0X4F)>=58.5 +#CPU Board +#Core>=62 +#LM75-1(0X4B)>=51.8 + +# 2. For AFO: +# At default, FAN duty_cycle was 100%(LEVEL_FAN_MAX). If all below case meet with, set to 75%(LEVEL_FAN_MID). +# (MB board) +# LM75-1(0X48)<=56 +# LM75-2(0X49)<=53.5 +# LM75-3(0X4A)<=52.5 +# LM75-4(0X4C)<=52 +# LM75-6(0X4F)<=52.8 +# (CPU board) +# Core<=62 +# LM75-1(0X4B)<=45.8 + +# When FAN duty_cycle was 75%(LEVEL_FAN_MID). If all below case meet with, set to 50%(LEVEL_FAN_DEF). +# (MB board) +# LM75-1(0X48)<=50 +# LM75-2(0X49)<=47.3 +# LM75-3(0X4A)<=46.4 +# LM75-4(0X4C)<=44.6 +# LM75-6(0X4F)<=47 +# (CPU board) +# Core<=56 +# LM75-1(0X4B)<=38.8 + +# When fan_speed 50%(LEVEL_FAN_DEF). +# Meet with below case, Fan duty_cycle will be 75%(LEVEL_FAN_MID) +# (MB board) +# LM75-1(0X48)>=63 +# LM75-2(0X49)>=60.5 +# LM75-3(0X4A)>=60 +# LM75-4(0X4C)>=60 +# LM75-6(0X4F)>=61 +# (CPU board) +# Core>=72 +# LM75-1(0X4B)>=50 + +# When FAN duty_cycle was 75%(LEVEL_FAN_MID). If all below case meet with, set to 100%(LEVEL_FAN_MAX). +# (MB board) +# LM75-1(0X48)>=63 +# LM75-2(0X49)>=60 +# LM75-3(0X4A)>=60 +# LM75-4(0X4C)>=59 +# LM75-6(0X4F)>=60 + +# (CPU board) +# Core >=69 +# LM75-1(0X4B)>=51.5 + + +#Yellow Alarm +#MB board +#LM75-1(0X48)>=67 +#LM75-2(0X49)>=65 +#LM75-3(0X4A)>=64 +#LM75-4(0X4C)>=62 +#LM75-6(0X4F)>=64 +#CPU Board +#Core>=73 +#LM75-1(0X4B)>=67 + +#Red Alarm +#MB board +#LM75-1(0X48)>=72 +#LM75-2(0X49)>=70 +#LM75-3(0X4A)>=69 +#LM75-4(0X4C)>=67 +#LM75-6(0X4F)>=69 +#CPU Board +#Core>=78 +#LM75-1(0X4B)>=72 + +#Shut down +#MB board +#LM75-1(0X48)>=77 +#LM75-2(0X49)>=75 +#LM75-3(0X4A)>=74 +#LM75-4(0X4C)>=72 +#LM75-6(0X4F)>=74 +#CPU Board +#Core>=83 +#LM75-1(0X4B)>=77 + +def power_off_dut(): + cmd_str="i2cset -y -f 1 0x60 0x60 0x10" + status, output = commands.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. +# Because the psu temp is high. +# Return 1: full load +# Return 0: Not full load +def check_psu_loading(): + psu_power_status=[1, 1] + + psu_power_good = { + 2: "/sys/bus/i2c/devices/9-0051/psu_power_good", + 1: "/sys/bus/i2c/devices/9-0050/psu_power_good", + } + psu_power_out = { + 2: "/sys/bus/i2c/devices/9-0059/psu_p_out", + 1: "/sys/bus/i2c/devices/9-0058/psu_p_out", + } + + check_psu_watt=0 + for i in range(1,3): + node = psu_power_good[i] + try: + with open(node, 'r') as power_status: + status = int(power_status.read()) + except IOError: + return None + + psu_power_status[i-1]=int(status) + if status==0: + check_psu_watt=1 + + if check_psu_watt: + for i in range(1,3): + if psu_power_status[i-1]==1: + #check watt + node = psu_power_out[i] + try: + with open(node, 'r') as power_status: + status = int(power_status.read()) + except IOError: + return None + psu_p_out= int(status) + if psu_p_out/1000 > 800: + return True + else: + return False + + + return False + +fan_policy_state=0 +fan_policy_alarm=0 +send_yellow_alarm=0 +send_red_alarm=0 +fan_fail=0 +count_check=0 + +test_temp = 0 +test_temp_list = [0, 0, 0, 0, 0, 0, 0] +temp_test_data=0 +test_temp_revert=0 + +# Make a class we can use to capture stdout and sterr in the log +class device_monitor(object): + # static temp var + temp = 0 + new_duty_cycle = 0 + duty_cycle=0 + ori_duty_cycle = 0 + + + def __init__(self, log_file, log_level): + """Needs a logger and a logger level.""" + + self.thermal = ThermalUtil() + self.fan = FanUtil() + # 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('%(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) + #logging.debug('SET. logfile:%s / loglevel:%d', log_file, log_level) + + + def manage_fans(self): + + global fan_policy_state + global fan_policy_alarm + global send_yellow_alarm + global send_red_alarm + global fan_fail + global count_check + global test_temp + global test_temp_list + global temp_test_data + global test_temp_revert + + CHECK_TIMES=3 + + LEVEL_FAN_INIT=0 + LEVEL_FAN_MIN=1 + LEVEL_FAN_MID=2 + LEVEL_FAN_MAX=3 + LEVEL_FAN_YELLOW_ALARM=4 + LEVEL_FAN_RED_ALARM=5 + LEVEL_FAN_SHUTDOWN=6 + + fan_policy_f2b = { #AFO + LEVEL_FAN_MIN: [50, 0x7], + LEVEL_FAN_MID: [75, 0xb], + LEVEL_FAN_MAX: [100, 0xf] + } + fan_policy_b2f = { #AFI + LEVEL_FAN_MID: [75, 0xb], + LEVEL_FAN_MAX: [100, 0xf] + } + + afi_thermal_spec={ + "mid_to_max_temp":[61500, 51500, 49400, 49400, 45100, 46750, 48000, 38500], + "max_to_mid_temp":[57000, 47300, 45000, 45100, 40750, 42100, 44000, 35000], + "max_to_yellow_alarm": [57900, 51900, 48900, 55900, 48500, 52000, 41800], + "yellow_to_red_alarm": [62900, 56900, 53900, 58900, 53500, 57000, 46800], + "red_alarm_to_shutdown": [67900, 61900, 58900, 63900, 58500, 62000, 51800] + } + afo_thermal_spec={ + "min_to_mid_temp": [63000, 60500, 60000, 60000, 61000, 72000, 50000], + "mid_to_max_temp": [63000, 60000, 60000, 59000, 60000, 69000, 51500], + "max_to_mid_temp": [56000, 53500, 52500, 52000, 52800, 62000, 45800], + "mid_to_min_temp": [50000, 47300, 46400, 44600, 47000, 56000, 38800], + "max_to_yellow_alarm": [67000, 65000, 64000, 62000, 64000, 73000, 67000], + "yellow_to_red_alarm": [72000, 70000, 69000, 67000, 69000, 78000, 72000], + "red_alarm_to_shutdown": [77000, 75000, 74000, 72000, 74000, 83000, 77000] + } + + thermal_val=[0,0,0,0,0,0,0] + max_to_mid=0 + mid_to_min=0 + + fan = self.fan + if fan_policy_state==LEVEL_FAN_INIT: + fan_policy_state=LEVEL_FAN_MAX #This is default state + logging.debug("fan_policy_state=LEVEL_FAN_MAX") + return + + count_check=count_check+1 + if count_check < CHECK_TIMES: + return + else: + count_check=0 + + thermal = self.thermal + fan_dir=fan.get_fan_dir(1) + + if fan_dir==1: # AFI + fan_thermal_spec = afi_thermal_spec + fan_policy=fan_policy_b2f + elif fan_dir==0: # AFO + fan_thermal_spec = afo_thermal_spec + fan_policy=fan_policy_f2b + else: + logging.debug( "NULL case") + + ori_duty_cycle=fan.get_fan_duty_cycle() + new_duty_cycle=0 + + if test_temp_revert==0: + temp_test_data=temp_test_data+2000 + else: + temp_test_data=temp_test_data-2000 + + if test_temp==0: + for i in range (thermal.THERMAL_NUM_1_IDX, thermal.THERMAL_NUM_MAX+1): + thermal_val[i-1]=thermal._get_thermal_val(i) + else: + for i in range (thermal.THERMAL_NUM_1_IDX, thermal.THERMAL_NUM_MAX+1): + thermal_val[i-1]=test_temp_list[i-1] + thermal_val[i-1]= thermal_val[i-1] + temp_test_data + logging.debug(thermal_val) + fan_fail=0 + + ori_state=fan_policy_state; + current_state=fan_policy_state; + + if fan_dir==1: #AFI + for i in range (0, thermal.THERMAL_NUM_MAX): + if ori_state==LEVEL_FAN_MID: + if thermal_val[i] >= fan_thermal_spec["mid_to_max_temp"][i]: + current_state=LEVEL_FAN_MAX + logging.debug("current_state=LEVEL_FAN_MAX") + break + else: + if (thermal_val[i] <= fan_thermal_spec["max_to_mid_temp"][i]): + max_to_mid=max_to_mid+1 + if fan_policy_alarm==0: + if thermal_val[i] >= fan_thermal_spec["max_to_yellow_alarm"][i]: + if send_yellow_alarm==0: + logging.warning('Alarm-Yellow for temperature high is detected') + fan_policy_alarm=LEVEL_FAN_YELLOW_ALARM + send_yellow_alarm=1 + elif fan_policy_alarm==LEVEL_FAN_YELLOW_ALARM: + if thermal_val[i] >= fan_thermal_spec["yellow_to_red_alarm"][i]: + if send_red_alarm==0: + logging.warning('Alarm-Red for temperature high is detected') + fan_policy_alarm=LEVEL_FAN_RED_ALARM + send_red_alarm=1 + elif fan_policy_alarm==LEVEL_FAN_RED_ALARM: + if thermal_val[i] >= fan_thermal_spec["red_alarm_to_shutdown"][i]: + logging.critical('Alarm-Critical for temperature high is detected, shutdown DUT') + fan_policy_alarm=LEVEL_FAN_SHUTDOWN + time.sleep(2) + power_off_dut() + + if max_to_mid==thermal.THERMAL_NUM_MAX and fan_policy_state==LEVEL_FAN_MAX: + current_state=LEVEL_FAN_MID + if fan_policy_alarm!=0: + logging.warning('Alarm for temperature high is cleared') + fan_policy_alarm=0 + send_yellow_alarm=0 + send_red_alarm=0 + test_temp_revert=0 + logging.debug("current_state=LEVEL_FAN_MID") + + else: #AFO + psu_full_load=check_psu_loading() + for i in range (0, thermal.THERMAL_NUM_MAX): + if ori_state==LEVEL_FAN_MID: + if thermal_val[i] >= fan_thermal_spec["mid_to_max_temp"][i]: + current_state=LEVEL_FAN_MAX + break + else: + if psu_full_load!=True and thermal_val[i] <= fan_thermal_spec["mid_to_min_temp"][i]: + mid_to_min=mid_to_min+1 + + elif ori_state==LEVEL_FAN_MIN: + if psu_full_load==True: + current_state=LEVEL_FAN_MID + logging.debug("psu_full_load, set current_state=LEVEL_FAN_MID") + if thermal_val[i] >= fan_thermal_spec["min_to_mid_temp"][i]: + current_state=LEVEL_FAN_MID + + else: + if thermal_val[i] <= fan_thermal_spec["max_to_mid_temp"][i] : + max_to_mid=max_to_mid+1 + if fan_policy_alarm==0: + if thermal_val[i] >= fan_thermal_spec["max_to_yellow_alarm"][i]: + if send_yellow_alarm==0: + logging.warning('Alarm-Yellow for temperature high is detected') + fan_policy_alarm=LEVEL_FAN_YELLOW_ALARM + send_yellow_alarm=1 + elif fan_policy_alarm==LEVEL_FAN_YELLOW_ALARM: + if thermal_val[i] >= fan_thermal_spec["yellow_to_red_alarm"][i]: + if send_red_alarm==0: + logging.warning('Alarm-Red for temperature high is detected') + fan_policy_alarm=LEVEL_FAN_RED_ALARM + send_red_alarm=1 + elif fan_policy_alarm==LEVEL_FAN_RED_ALARM: + if thermal_val[i] >= fan_thermal_spec["red_alarm_to_shutdown"][i]: + logging.critical('Alarm-Critical for temperature high is detected, shutdown DUT') + fan_policy_alarm=LEVEL_FAN_SHUTDOWN + time.sleep(2) + power_off_dut() + + if max_to_mid==thermal.THERMAL_NUM_MAX and ori_state==LEVEL_FAN_MAX: + current_state=LEVEL_FAN_MID + if fan_policy_alarm!=0: + logging.warning('Alarm for temperature high is cleared') + fan_policy_alarm=0 + send_yellow_alarm=0 + send_red_alarm=0 + test_temp_revert=0 + logging.debug("current_state=LEVEL_FAN_MID") + + if mid_to_min==thermal.THERMAL_NUM_MAX and ori_state==LEVEL_FAN_MID: + if psu_full_load==0: + current_state=LEVEL_FAN_MIN + logging.debug("current_state=LEVEL_FAN_MIN") + + #Check Fan fault status. True: fan not fault/present, 1: fan fault/un-present + for i in range (fan.FAN_NUM_1_IDX, fan.FAN_NUM_ON_MAIN_BROAD+1): + if fan.get_fan_status(i)==False: + new_duty_cycle=100 + current_state=LEVEL_FAN_MAX + logging.debug('fan_%d fail, set duty_cycle to 100',i) + if test_temp==0: + fan_fail=1 + fan.set_fan_duty_cycle(new_duty_cycle) + break + else: + fan_fail=0 + + if current_state!=ori_state: + fan_policy_state=current_state + new_duty_cycle=fan_policy[current_state][0] + logging.debug("fan_policy_state=%d, new_duty_cycle=%d", fan_policy_state, new_duty_cycle) + if new_duty_cycle!=ori_duty_cycle and fan_fail==0: + fan.set_fan_duty_cycle(new_duty_cycle) + return True + if new_duty_cycle==0 and fan_fail==0: + fan.set_fan_duty_cycle(FAN_DUTY_CYCLE_MAX) + + return True + +def main(argv): + log_file = '%s.log' % FUNCTION_NAME + log_level = logging.INFO + global test_temp + 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)!=9: + print "temp test, need input 7 temp" + return 0 + i=0 + for x in range(2, 9): + test_temp_list[i]= int(sys.argv[x])*1000 + i=i+1 + test_temp = 1 + log_level = logging.DEBUG + print test_temp_list + + fan = FanUtil() + fan.set_fan_duty_cycle(100) + monitor = device_monitor(log_file, log_level) + # Loop forever, doing something useful hopefully: + while True: + monitor.manage_fans() + time.sleep(3) + +if __name__ == '__main__': + main(sys.argv[1:]) 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 new file mode 100755 index 000000000000..0e3d8ee08a63 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/utils/accton_as9726_32d_monitor_fan.py @@ -0,0 +1,186 @@ +#!/usr/bin/env python +# +# Copyright (C) 2018 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.) +# 04/23/2021: Michael_Shih create for as9726-32d +# ------------------------------------------------------------------ + +try: + import getopt + import sys + import logging + import logging.config + import logging.handlers + import time # this is only being used as part of the example +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + +# Deafults +VERSION = '1.0' +FUNCTION_NAME = '/usr/local/bin/accton_as9726_32d_monitor_fan' + +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 + + +fan_state=[2, 2, 2, 2, 2, 2] #init state=2, insert=1, remove=0 +fan_status_state=[2, 2, 2, 2, 2, 2] #init state=2, fault=1, normal=0 +# Make a class we can use to capture stdout and sterr in the log +class device_monitor(object): + + def __init__(self, log_file, log_level): + + self.fan_num = 6 + self.fan_path = "/sys/bus/i2c/devices/14-0066/" + self.present = { + 0: "fan1_present", + 1: "fan2_present", + 2: "fan3_present", + 3: "fan4_present", + 4: "fan5_present", + 5: "fan6_present", + } + + self.fault = { + 0: "fan1_fault", + 1: "fan2_fault", + 2: "fan3_fault", + 3: "fan4_fault", + 4: "fan5_fault", + 5: "fan6_fault", + } + + + """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(logging.DEBUG) + formatter = logging.Formatter('%(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) + sys_handler.setLevel(logging.INFO) + logging.getLogger('').addHandler(sys_handler) + + + #logging.debug('SET. logfile:%s / loglevel:%d', log_file, log_level) + + def manage_fan(self): + + FAN_STATE_REMOVE = 0 + FAN_STATE_INSERT = 1 + + FAN_STATUS_FAULT = 1 + FAN_STATUS_NORMAL = 0 + + global fan_state + global fan_status_state + + for idx in range (0, self.fan_num): + node = self.fan_path + self.present[idx] + try: + val_file = open(node) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + content = val_file.readline().rstrip() + val_file.close() + # content is a string, either "0" or "1" + if content == "1": + if fan_state[idx]!=1: + fan_state[idx]=FAN_STATE_INSERT + logging.info("FAN-%d present is detected", idx+1); + else: + if fan_state[idx]!=0: + fan_state[idx]=FAN_STATE_REMOVE + logging.warning("Alarm for FAN-%d absent is detected", idx+1) + + for idx in range (0, self.fan_num): + node = self.fan_path + self.fault[idx] + try: + val_file = open(node) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + content = val_file.readline().rstrip() + val_file.close() + # content is a string, either "0" or "1" + if content == "1": + if fan_status_state[idx]!=FAN_STATUS_FAULT: + if fan_state[idx] == FAN_STATE_INSERT: + logging.warning("Alarm for FAN-%d failed is detected", idx+1); + fan_status_state[idx]=FAN_STATUS_FAULT + else: + fan_status_state[idx]=FAN_STATUS_NORMAL + + return True + +def main(argv): + log_file = '%s.log' % FUNCTION_NAME + log_level = logging.INFO + if len(sys.argv) != 1: + try: + opts, args = getopt.getopt(argv,'hdl:',['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 + monitor = device_monitor(log_file, log_level) + while True: + monitor.manage_fan() + time.sleep(3) + +if __name__ == '__main__': + main(sys.argv[1:]) 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 new file mode 100755 index 000000000000..d9159c38bcf1 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/utils/accton_as9726_32d_monitor_psu.py @@ -0,0 +1,159 @@ +#!/usr/bin/env python +# +# Copyright (C) 2018 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.) +# 04/23/2021: Michael_shih create for as9726-32d +# ------------------------------------------------------------------ + +try: + import getopt + import sys + import logging + import logging.config + import logging.handlers + import time # this is only being used as part of the example +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + +# Deafults +VERSION = '1.0' +FUNCTION_NAME = '/usr/local/bin/accton_as9726_32d_monitor_psu' + +psu_state=[2, 2] +psu_status_state=[2, 2] +# Make a class we can use to capture stdout and sterr in the log +class device_monitor(object): + + def __init__(self, log_file, log_level): + + self.psu_num = 2 + self.psu_path = "/sys/bus/i2c/devices/" + self.presence = "/psu_present" + self.oper_status = "/psu_power_good" + self.mapping = { + 0: "9-0050", + 1: "9-0051", + } + + """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('%(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) + sys_handler.setLevel(logging.INFO) + logging.getLogger('').addHandler(sys_handler) + + #logging.debug('SET. logfile:%s / loglevel:%d', log_file, log_level) + + def manage_psu(self): + + PSU_STATE_REMOVE = 0 + PSU_STATE_INSERT = 1 + + PSU_STATUS_NO_POWER = 0 + PSU_STATUS_POWER_GOOD = 1 + PSU_STATUS_IDLE =2 + + global psu_state + + for idx in range (0, self.psu_num): + node = self.psu_path + self.mapping[idx] + self.presence + try: + val_file = open(node) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + content = val_file.readline().rstrip() + val_file.close() + # content is a string, either "0" or "1" + if content == "1": + if psu_state[idx]!=1: + psu_state[idx]=PSU_STATE_INSERT + logging.info("PSU-%d present is detected", idx+1); + #psu_status_state[idx]=PSU_STATUS_POWER_GOOD #when insert, assume power is good. If no_power, next code will find it. + else: + if psu_state[idx]!=0: + psu_state[idx]=PSU_STATE_REMOVE + logging.warning("Alarm for PSU-%d absent is detected", idx+1); + psu_status_state[idx]=PSU_STATUS_IDLE + + for idx in range (0, self.psu_num): + node = self.psu_path + self.mapping[idx] + self.oper_status + try: + val_file = open(node) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + content = val_file.readline().rstrip() + val_file.close() + # content is a string, either "0" or "1" + if content == "0": + if psu_status_state[idx]!=PSU_STATUS_NO_POWER: + if psu_state[idx]==PSU_STATE_INSERT: + logging.warning("Alarm for PSU-%d failed is detected", idx+1); + psu_status_state[idx]=PSU_STATUS_NO_POWER + else: + if psu_state[idx]==PSU_STATE_INSERT: + if psu_status_state[idx]!=PSU_STATUS_POWER_GOOD: + logging.info("PSU-%d power_good is detected", idx+1); + psu_status_state[idx]=PSU_STATUS_POWER_GOOD + + + return True + +def main(argv): + log_file = '%s.log' % FUNCTION_NAME + log_level = logging.INFO + if len(sys.argv) != 1: + try: + opts, args = getopt.getopt(argv,'hdl:',['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 + monitor = device_monitor(log_file, log_level) + # Loop forever, doing something useful hopefully: + while True: + monitor.manage_psu() + time.sleep(3) + +if __name__ == '__main__': + main(sys.argv[1:]) 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 new file mode 100755 index 000000000000..d686a77b91c5 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/utils/accton_as9726_32d_util.py @@ -0,0 +1,680 @@ +#!/usr/bin/env python +# +# 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 + show : show all systen status + sfp : dump SFP eeprom + set : change board setting with fan|sfp +""" + +import commands +import getopt +import sys +import logging +import re +import time +import os + +PROJECT_NAME = 'as9726_32d' +version = '0.0.1' +verbose = False +DEBUG = False +args = [] +ALL_DEVICE = {} +DEVICE_NO = { + 'fan1': 3, + 'fan2': 3, + 'fan3': 3, + 'fan4': 3, + 'fan5': 3, + 'fan6': 3, + 'thermal': 6, + 'psu': 2, + 'sfp': 34} + +fan_prefix = '/sys/devices/platform/as9726_32d_' +hwmon_types = {'fan1': ['fan'], + 'fan2': ['fan'], + 'fan3': ['fan'], + 'fan4': ['fan'], + 'fan5': ['fan'], + 'fan6': ['fan'], + } +hwmon_nodes = { + 'fan1': [ + 'fan_duty_cycle_percentage', + 'fan1_fault', + 'fan1_front_speed_rpm', + 'fan1_direction', + 'fan1_rear_speed_rpm'], + 'fan2': [ + 'fan_duty_cycle_percentage', + 'fan2_fault', + 'fan2_front_speed_rpm', + 'fan2_direction', + 'fan2_rear_speed_rpm'], + 'fan3': [ + 'fan_duty_cycle_percentage', + 'fan3_fault', + 'fan3_front_speed_rpm', + 'fan3_direction', + 'fan3_rear_speed_rpm'], + 'fan4': [ + 'fan4_duty_cycle_percentage', + 'fan4_fault', + 'fan4_front_speed_rpm', + 'fan4_direction', + 'fan4_rear_speed_rpm'], + 'fan5': [ + 'fan_duty_cycle_percentage', + 'fan5_fault', + 'fan5_front_speed_rpm', + 'fan5_direction', + 'fan5_rear_speed_rpm'], + 'fan6': [ + 'fan_duty_cycle_percentage', + 'fan6_fault', + 'fan6_front_speed_rpm', + 'fan6_direction', + 'fan6_rear_speed_rpm'], +} +hwmon_prefix = {'fan1': fan_prefix, + 'fan2': fan_prefix, + 'fan3': fan_prefix, + 'fan4': fan_prefix, + 'fan5': fan_prefix, + 'fan6': fan_prefix, + } + +i2c_prefix = '/sys/bus/i2c/devices/' +i2c_bus = {'fan': ['14-0066'], + 'thermal': ['15-0048', '15-0049', '15-004a', '15-004b', '15-004c', '15-004f'], + 'psu': ['9-0050', '9-0051'], + 'sfp': ['10-0061', '10-0062']} +i2c_nodes = {'fan': ['present', 'front_speed_rpm', 'rear_speed_rpm'], + 'thermal': ['hwmon/hwmon*/temp1_input'], + 'psu': ['psu_present ', 'psu_power_good'], + 'sfp': ['module_present_', 'module_tx_disable_']} + +sfp_map = [17, 18, 19, 20, 21, 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] + +mknod = [ + # i2c-mux + 'echo pca9548 0x77 > /sys/bus/i2c/devices/i2c-0/new_device', + 'echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-1/new_device', + 'echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-1/new_device', + 'echo pca9548 0x73 > /sys/bus/i2c/devices/i2c-1/new_device', + 'echo pca9548 0x74 > /sys/bus/i2c/devices/i2c-1/new_device', + 'echo pca9548 0x75 > /sys/bus/i2c/devices/i2c-1/new_device', + 'echo pca9548 0x76 > /sys/bus/i2c/devices/i2c-1/new_device', + + # CPLD + 'echo as9726_32d_cpld_cpu 0x65 > /sys/bus/i2c/devices/i2c-1/new_device', + 'echo as9726_32d_fpga 0x60 > /sys/bus/i2c/devices/i2c-1/new_device', + 'echo as9726_32d_cpld2 0x61 > /sys/bus/i2c/devices/i2c-10/new_device', + 'echo as9726_32d_cpld3 0x62 > /sys/bus/i2c/devices/i2c-10/new_device', + + # FAN + 'echo as9726_32d_fan 0x66 > /sys/bus/i2c/devices/i2c-14/new_device', + + # LM75 + 'echo lm75 0x48 > /sys/bus/i2c/devices/i2c-15/new_device', + 'echo lm75 0x49 > /sys/bus/i2c/devices/i2c-15/new_device', + 'echo lm75 0x4a > /sys/bus/i2c/devices/i2c-15/new_device', + 'echo lm75 0x4b > /sys/bus/i2c/devices/i2c-15/new_device', + 'echo lm75 0x4c > /sys/bus/i2c/devices/i2c-15/new_device', + 'echo lm75 0x4f > /sys/bus/i2c/devices/i2c-15/new_device', + + # PSU-1 + 'echo ym2401 0x58 > /sys/bus/i2c/devices/i2c-9/new_device', + 'echo as9726_32d_psu1 0x50 > /sys/bus/i2c/devices/i2c-9/new_device', + + # PSU-2 + 'echo ym2401 0x59 > /sys/bus/i2c/devices/i2c-9/new_device', + 'echo as9726_32d_psu2 0x51 > /sys/bus/i2c/devices/i2c-9/new_device', + + # CPU EERPOM + 'echo 24c02 0x57 > /sys/bus/i2c/devices/i2c-1/new_device', + # MAINBOARD EEPROM + 'echo 24c02 0x56 > /sys/bus/i2c/devices/i2c-13/new_device', +] + +FORCE = 0 + +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: + 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: + 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() + 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]} + 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" + sys.exit(0) + + +def show_eeprom_help(): + cmd = sys.argv[0].split("/")[-1] + " " + args[0] + print " use \"" + cmd + " 1-32 \" to dump sfp# eeprom" + sys.exit(0) + + +def my_log(txt): + if DEBUG: + print "[ACCTON DBG]: " + txt + return + + +def log_os_system(cmd, show): + logging.info('Run :' + cmd) + output = "" + status, output = commands.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) + return status, output + + +def driver_inserted(): + ret, lsmod = log_os_system("ls /sys/module/*accton*", 0) + logging.info('mods:' + lsmod) + if ret: + return False + +#'modprobe cpr_4011_4mxx', + + +kos = [ + 'depmod -ae', + 'modprobe i2c_dev', + 'modprobe i2c_mux_pca954x force_deselect_on_exit=1', + 'modprobe ym2651y', + 'modprobe x86-64-accton-as9726-32d_cpld', + 'modprobe x86-64-accton-as9726-32d_fan', + 'modprobe x86-64-accton-as9726-32d_psu', + 'modprobe optoe', + 'modprobe lm75'] + + +def driver_install(): + global FORCE + + for i in range(0, len(kos)): + 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") + lst = rm.split(" ") + print "lst=%s" % lst + if len(lst) > 3: + del(lst[3]) + rm = " ".join(lst) + status, output = log_os_system(rm, 1) + if status: + if FORCE == 0: + return status + return 0 + + +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(2) + + status, output = log_os_system(mknod[i], 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)): + opt = 'optoe2' #last 2 port is sfp + else: + opt = 'optoe1' #first 32 port is qsfp + status, output = log_os_system("echo " + + str(opt) + + " 0x50 > /sys/bus/i2c/devices/i2c-" + + str(sfp_map[i]) + + "/new_device", 1) + if status: + 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 + if FORCE == 0: + return status + + return + + +def device_uninstall(): + global FORCE + + for i in range(0, len(sfp_map)): + 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 + 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_inserted() == False: + return False + if not device_exist(): + print "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(): + if driver_inserted() == False: + status = driver_install() + if status: + if FORCE == 0: + return status + else: + 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...." + +# for i in range(len(cpld_set)): +# status, output = log_os_system(cpld_set[i], 1) +# if status: +# if FORCE == 0: +# return status + + do_sonic_platform_install() + + return + + +def do_uninstall(): + 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_inserted() == False: + print PROJECT_NAME.upper() + " has no driver installed...." + else: + print "Removing installed driver...." + status = driver_uninstall() + if status: + if FORCE == 0: + return status + + do_sonic_platform_clean() + + 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, 6): + node = key + str(k + 1) + path = i2c_prefix + \ + buses[i] + "/fan" + str(k + 1) + "_" + nodes[j] + my_log(node + ": " + path) + ALL_DEVICE[key + str(k + 1)][node + str(j + 1)].append(path) + elif 'sfp' == key: + for k in range(0, DEVICE_NO[key]): + node = key + str(k + 1) + if k < 16 and i==0 and j==0: + path = i2c_prefix + \ + str(buses[0] + "/" + nodes[j] + str(k+1)) + my_log(node + ": " + path) + ALL_DEVICE[key][node].append(path) + if k >= 16 and i==1 and j==0: + path = i2c_prefix + \ + str(buses[1] + "/" + nodes[j] + str(k+1)) + my_log(node + ": " + path) + ALL_DEVICE[key][node].append(path) + if k >= 32 and i==1 and j==1: + path = i2c_prefix + \ + str(buses[1] + "/" + 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: + 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') + sfp_node = str(sfp_map[int(index)-1]) + '-0050' + node = node.replace(node.split("/")[-2], sfp_node) + # 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=%s" % node + 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] == '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['fan1']['fan11'][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]) < DEVICE_NO[args[0]]-1: #33-34 + show_set_help() + return + if len(args)<3 or len(args)>4: #len(args)=3 + show_set_help() + return + if int(args[2])>1 or int(args[2])<0: #0|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 + else: + show_set_help() + + return + +# get digits inside a string. +# Ex: 31 for "sfp31" + + +def get_value(input): + digit = re.findall(r'\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(): + ret1, log = log_os_system("ls " + i2c_prefix + "*0077", 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-accton/debian/control b/platform/broadcom/sonic-platform-modules-accton/debian/control index 431e177cea48..4410a2f07796 100755 --- a/platform/broadcom/sonic-platform-modules-accton/debian/control +++ b/platform/broadcom/sonic-platform-modules-accton/debian/control @@ -69,6 +69,10 @@ Package: sonic-platform-accton-as9716-32d Architecture: amd64 Description: kernel modules for platform devices such as fan, led, sfp +Package: sonic-platform-accton-as9726-32d +Architecture: amd64 +Description: kernel modules for platform devices such as fan, led, sfp + Package: sonic-platform-accton-as5835-54t Architecture: amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/rules b/platform/broadcom/sonic-platform-modules-accton/debian/rules index a672ec655d41..678d649a79ed 100755 --- a/platform/broadcom/sonic-platform-modules-accton/debian/rules +++ b/platform/broadcom/sonic-platform-modules-accton/debian/rules @@ -22,7 +22,7 @@ KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) MODULE_DIRS := as7712-32x as5712-54x as7816-64x as7716-32x as7716-32xb as7312-54x MODULE_DIRS += as7326-56x as6712-32x as7726-32x as4630-54pe as4630-54te minipack as5812-54x -MODULE_DIRS += as5835-54x as9716-32d as5835-54t as7312-54xs as7315-27xb as5812-54t +MODULE_DIRS += as5835-54x as9716-32d as9726-32d as5835-54t as7312-54xs as7315-27xb as5812-54t MODULE_DIR := modules UTILS_DIR := utils SERVICE_DIR := service diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as9726-32d.install b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as9726-32d.install new file mode 100644 index 000000000000..01eb8dff9e41 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as9726-32d.install @@ -0,0 +1,2 @@ +as9726-32d/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-accton_as9726_32d-r0 + From 129f803e11f517b481a489f7450d320326bb44ce Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Tue, 11 May 2021 18:04:01 +0800 Subject: [PATCH 051/136] Fix the /var wrong permission issue (#7571) Why I did it Build broken when reproducible build enabled, relative to backport package systemd. The root cause is the bad permission of /var. --- scripts/build_debian_base_system.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build_debian_base_system.sh b/scripts/build_debian_base_system.sh index fe7841067e82..e8c5ab42fe18 100755 --- a/scripts/build_debian_base_system.sh +++ b/scripts/build_debian_base_system.sh @@ -78,7 +78,7 @@ do done touch $APTDEBIAN touch $DEBOOTSTRAP_BASE -(cd $BASEIMAGE_TARBALLPATH && tar -zcf $BASEIMAGE_TARBALL .) +(cd $BASEIMAGE_TARBALLPATH && fakeroot tar -zcf $BASEIMAGE_TARBALL .) sudo debootstrap --verbose --variant=minbase --arch $CONFIGURED_ARCH --unpack-tarball=$BASEIMAGE_TARBALL $IMAGE_DISTRO $FILESYSTEM_ROOT RET=$? From 3ccc45f5b8be0b5d8bfdf177a43541ed9a69c569 Mon Sep 17 00:00:00 2001 From: tomer-israel <76040066+tomer-israel@users.noreply.github.com> Date: Wed, 12 May 2021 22:21:04 +0300 Subject: [PATCH 052/136] [Mellanox] Add initial support for SN4800 platform (#7447) - Why I did it Add initial support of SN4800 platform . NOTE: This is work in progress and not full support of the platform. - How I did it Add new folders for SN4800 with zero ports based on SN4700 Spectrum-3 switch. - How to verify it Simulator device was tested. See #7448 --- .../ACS-MSN4800/buffers.json.j2 | 1 + .../ACS-MSN4800/buffers_defaults_t0.j2 | 1 + .../ACS-MSN4800/buffers_defaults_t1.j2 | 1 + .../ACS-MSN4800/buffers_dynamic.json.j2 | 1 + .../ACS-MSN4800/hwsku.json | 4 + .../ACS-MSN4800/pg_profile_lookup.ini | 1 + .../ACS-MSN4800/port_config.ini | 1 + .../ACS-MSN4800/qos.json.j2 | 1 + .../ACS-MSN4800/sai.profile | 1 + .../ACS-MSN4800/sai_4800.xml | 16 ++ .../x86_64-mlnx_msn4800-r0/default_sku | 1 + .../mellanox/x86_64-mlnx_msn4800-r0/pcie.yaml | 111 ++++++++++ .../x86_64-mlnx_msn4800-r0/platform.json | 124 ++++++++++++ .../platform_components.json | 14 ++ .../x86_64-mlnx_msn4800-r0/platform_reboot | 1 + .../x86_64-mlnx_msn4800-r0/platform_wait | 1 + .../x86_64-mlnx_msn4800-r0/plugins/eeprom.py | 1 + .../x86_64-mlnx_msn4800-r0/plugins/psuutil.py | 1 + .../plugins/sfplpmget.py | 1 + .../plugins/sfplpmset.py | 1 + .../plugins/sfpreset.py | 1 + .../x86_64-mlnx_msn4800-r0/plugins/sfputil.py | 1 + .../pmon_daemon_control.json | 1 + .../x86_64-mlnx_msn4800-r0/sensors.conf | 189 ++++++++++++++++++ .../system_health_monitoring_config.json | 1 + .../thermal_policy.json | 1 + 26 files changed, 478 insertions(+) create mode 120000 device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/buffers.json.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/buffers_defaults_t0.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/buffers_defaults_t1.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/buffers_dynamic.json.j2 create mode 100644 device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/hwsku.json create mode 120000 device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/pg_profile_lookup.ini create mode 100644 device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/port_config.ini create mode 120000 device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/qos.json.j2 create mode 100644 device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/sai.profile create mode 100644 device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/sai_4800.xml create mode 100644 device/mellanox/x86_64-mlnx_msn4800-r0/default_sku create mode 100644 device/mellanox/x86_64-mlnx_msn4800-r0/pcie.yaml create mode 100644 device/mellanox/x86_64-mlnx_msn4800-r0/platform.json create mode 100644 device/mellanox/x86_64-mlnx_msn4800-r0/platform_components.json create mode 120000 device/mellanox/x86_64-mlnx_msn4800-r0/platform_reboot create mode 120000 device/mellanox/x86_64-mlnx_msn4800-r0/platform_wait create mode 120000 device/mellanox/x86_64-mlnx_msn4800-r0/plugins/eeprom.py create mode 120000 device/mellanox/x86_64-mlnx_msn4800-r0/plugins/psuutil.py create mode 120000 device/mellanox/x86_64-mlnx_msn4800-r0/plugins/sfplpmget.py create mode 120000 device/mellanox/x86_64-mlnx_msn4800-r0/plugins/sfplpmset.py create mode 120000 device/mellanox/x86_64-mlnx_msn4800-r0/plugins/sfpreset.py create mode 120000 device/mellanox/x86_64-mlnx_msn4800-r0/plugins/sfputil.py create mode 120000 device/mellanox/x86_64-mlnx_msn4800-r0/pmon_daemon_control.json create mode 100644 device/mellanox/x86_64-mlnx_msn4800-r0/sensors.conf create mode 120000 device/mellanox/x86_64-mlnx_msn4800-r0/system_health_monitoring_config.json create mode 120000 device/mellanox/x86_64-mlnx_msn4800-r0/thermal_policy.json diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/buffers.json.j2 b/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/buffers.json.j2 new file mode 120000 index 000000000000..f46e9600153b --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/buffers.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers.json.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-mlnx_msn4800-r0/ACS-MSN4800/buffers_defaults_t0.j2 new file mode 120000 index 000000000000..ddb883a1daa4 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/buffers_defaults_t0.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_defaults_t0.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/buffers_defaults_t1.j2 new file mode 120000 index 000000000000..f8bbb6e631e7 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/buffers_defaults_t1.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn4700-r0/ACS-MSN4700/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-mlnx_msn4800-r0/ACS-MSN4800/buffers_dynamic.json.j2 new file mode 120000 index 000000000000..8c4117c66214 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/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-mlnx_msn4800-r0/ACS-MSN4800/hwsku.json new file mode 100644 index 000000000000..15b56762dcda --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/hwsku.json @@ -0,0 +1,4 @@ +{ + "interfaces": { + } +} diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/pg_profile_lookup.ini new file mode 120000 index 000000000000..88e51ceae044 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/pg_profile_lookup.ini @@ -0,0 +1 @@ +../../x86_64-mlnx_msn4700-r0/ACS-MSN4700/pg_profile_lookup.ini \ 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 new file mode 100644 index 000000000000..51c0ed3798cc --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/port_config.ini @@ -0,0 +1 @@ +# name lanes alias index diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/qos.json.j2 new file mode 120000 index 000000000000..eccf286dc879 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/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-mlnx_msn4800-r0/ACS-MSN4800/sai.profile new file mode 100644 index 000000000000..3a8824058cf0 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_4800.xml 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 new file mode 100644 index 000000000000..1625d5b60948 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/sai_4800.xml @@ -0,0 +1,16 @@ + + + + + + 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 new file mode 100644 index 000000000000..f50c8b52baa3 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800-r0/default_sku @@ -0,0 +1 @@ +ACS-MSN4800 t1 diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/pcie.yaml b/device/mellanox/x86_64-mlnx_msn4800-r0/pcie.yaml new file mode 100644 index 000000000000..a86731abe935 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800-r0/pcie.yaml @@ -0,0 +1,111 @@ +- bus: '00' + dev: '00' + fn: '0' + id: 3e10 + name: 'Host bridge : Intel Corporation Device (rev 07)' +- bus: '00' + dev: '01' + fn: '0' + id: 1901 + name: 'PCI bridge : Intel Corporation Skylake PCIe Controller (x16) (rev 07) + (prog-if 00 [Normal decode])' +- bus: '00' + dev: '08' + fn: '0' + id: 1911 + name: 'System peripheral : Intel Corporation Skylake Gaussian Mixture Model' +- bus: '00' + dev: '12' + fn: '0' + id: a379 + name: 'Signal processing controller : Intel Corporation Device (rev 10)' +- bus: '00' + dev: '14' + fn: '0' + id: a36d + name: 'USB controller : Intel Corporation Device (rev 10) (prog-if 30 [XHCI])' +- bus: '00' + dev: '14' + fn: '2' + id: a36f + name: 'RAM memory : Intel Corporation Device (rev 10)' +- bus: '00' + dev: '15' + fn: '0' + id: a368 + name: 'Serial bus controller : Intel Corporation Device (rev 10)' +- bus: '00' + dev: '16' + fn: '0' + id: a360 + name: 'Communication controller : Intel Corporation Device (rev 10)' +- bus: '00' + dev: '17' + fn: '0' + id: a353 + name: 'SATA controller : Intel Corporation Device (rev 10) (prog-if 01 [AHCI 1.0])' +- bus: '00' + dev: '1b' + fn: '0' + id: a340 + name: 'PCI bridge : Intel Corporation Device (rev f0) (prog-if 00 [Normal decode])' +- bus: '00' + dev: '1b' + fn: '2' + id: a342 + name: 'PCI bridge : Intel Corporation Device (rev f0) (prog-if 00 [Normal decode])' +- bus: '00' + dev: '1b' + fn: '4' + id: a32c + name: 'PCI bridge : Intel Corporation Device (rev f0) (prog-if 00 [Normal decode])' +- bus: '00' + dev: '1c' + fn: '0' + id: a33d + name: 'PCI bridge : Intel Corporation Device (rev f0) (prog-if 00 [Normal decode])' +- bus: '00' + dev: '1c' + fn: '6' + id: a33e + name: 'PCI bridge : Intel Corporation Device (rev f0) (prog-if 00 [Normal decode])' +- bus: '00' + dev: '1c' + fn: '7' + id: a33f + name: 'PCI bridge : Intel Corporation Device (rev f0) (prog-if 00 [Normal decode])' +- bus: '00' + dev: '1d' + fn: '0' + id: a334 + name: 'PCI bridge : Intel Corporation Device (rev f0) (prog-if 00 [Normal decode])' +- bus: '00' + dev: '1e' + fn: '0' + id: a328 + name: 'Communication controller : Intel Corporation Device (rev 10)' +- bus: '00' + dev: '1f' + fn: '0' + id: a30e + name: 'ISA bridge : Intel Corporation Device (rev 10)' +- bus: '00' + dev: '1f' + fn: '4' + id: a323 + name: 'SMBus : Intel Corporation Device (rev 10)' +- bus: '00' + dev: '1f' + fn: '5' + id: a324 + name: 'Serial bus controller : Intel Corporation Device (rev 10)' +- bus: '00' + dev: '1f' + fn: '6' + id: 15bb + name: 'Ethernet controller : Intel Corporation Device (rev 10)' +- bus: '01' + dev: '00' + fn: '0' + id: cf6c + name: 'Ethernet controller : Mellanox Technologies Device' diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/platform.json b/device/mellanox/x86_64-mlnx_msn4800-r0/platform.json new file mode 100644 index 000000000000..78f94767a2b6 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800-r0/platform.json @@ -0,0 +1,124 @@ +{ + "chassis": { + "name": "MSN4800", + "components": [ + { + "name": "ONIE" + }, + { + "name": "SSD" + }, + { + "name": "BIOS" + }, + { + "name": "CPLD1" + }, + { + "name": "CPLD2" + }, + { + "name": "CPLD3" + } + ], + "fans": [], + "fan_drawers": [ + { + "name": "drawer1", + "fans": [ + { + "name": "fan1" + }, + { + "name": "fan2" + } + ] + }, + { + "name": "drawer2", + "fans": [ + { + "name": "fan3" + }, + { + "name": "fan4" + } + ] + }, + { + "name": "drawer3", + "fans": [ + { + "name": "fan5" + }, + { + "name": "fan6" + } + ] + }, + { + "name": "drawer4", + "fans": [ + { + "name": "fan7" + }, + { + "name": "fan8" + } + ] + } + ], + "psus": [ + { + "name": "PSU 1", + "fans": [ + { + "name": "psu_1_fan_1" + } + ], + "thermals": [ + { + "name": "PSU-1 Temp" + } + ] + }, + { + "name": "PSU 2", + "fans": [ + { + "name": "PSU-2 Temp" + } + ], + "thermals": [ + { + "name": "xSFP module 1 Temp" + } + ] + } + ], + "thermals": [ + { + "name": "ASIC" + }, + { + "name": "Ambient Fan Side Temp" + }, + { + "name": "Ambient Port Side Temp" + }, + { + "name": "CPU Core 0 Temp" + }, + { + "name": "CPU Core 1 Temp" + }, + { + "name": "CPU Pack Temp" + } + ], + "sfps": [ + ] + }, + "interfaces": { + } +} diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/platform_components.json b/device/mellanox/x86_64-mlnx_msn4800-r0/platform_components.json new file mode 100644 index 000000000000..cdd08c656105 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800-r0/platform_components.json @@ -0,0 +1,14 @@ +{ + "chassis": { + "MSN4800": { + "component": { + "ONIE": { }, + "SSD": { }, + "BIOS": { }, + "CPLD1": { }, + "CPLD2": { }, + "CPLD3": { } + } + } + } +} diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/platform_reboot b/device/mellanox/x86_64-mlnx_msn4800-r0/platform_reboot new file mode 120000 index 000000000000..43c8ea567493 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800-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-mlnx_msn4800-r0/platform_wait new file mode 120000 index 000000000000..4b30bd429854 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800-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-mlnx_msn4800-r0/plugins/eeprom.py new file mode 120000 index 000000000000..b4e2a6a61671 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800-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-mlnx_msn4800-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_msn4800-r0/plugins/psuutil.py new file mode 120000 index 000000000000..9f724238a8d5 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800-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-mlnx_msn4800-r0/plugins/sfplpmget.py b/device/mellanox/x86_64-mlnx_msn4800-r0/plugins/sfplpmget.py new file mode 120000 index 000000000000..2e84f435abd9 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800-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-mlnx_msn4800-r0/plugins/sfplpmset.py b/device/mellanox/x86_64-mlnx_msn4800-r0/plugins/sfplpmset.py new file mode 120000 index 000000000000..6a88bac30467 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800-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-mlnx_msn4800-r0/plugins/sfpreset.py b/device/mellanox/x86_64-mlnx_msn4800-r0/plugins/sfpreset.py new file mode 120000 index 000000000000..fef2063e3496 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800-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-mlnx_msn4800-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn4800-r0/plugins/sfputil.py new file mode 120000 index 000000000000..45909b880fc9 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800-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-r0/pmon_daemon_control.json b/device/mellanox/x86_64-mlnx_msn4800-r0/pmon_daemon_control.json new file mode 120000 index 000000000000..435a2ce7c0ba --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800-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-mlnx_msn4800-r0/sensors.conf new file mode 100644 index 000000000000..f5d5d4763d5f --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800-r0/sensors.conf @@ -0,0 +1,189 @@ +################################################################################ +# Copyright (c) 2021 Mellanox Technologies +# +# Platform specific sensors config for SN4800 +################################################################################ + +# 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 OSFP PORTS_P01_P08 Rail (out1)" + compute in2 (2)*@, @/(2) + label in3 "PMIC-1 OSFP PORTS_P09_P16 Rail (out2)" + compute in3 (2)*@, @/(2) + label temp1 "PMIC-1 OSFP PORTS_P01_P08 Temp 1" + label temp2 "PMIC-1 OSFP PORTS_P09_P16 Temp 2" + label power1 "PMIC-1 12V OSFP PORT_P01_P16 (in)" + label power2 "PMIC-1 OSFP P01_P08 Rail Pwr (out1)" + label power3 "PMIC-1 OSFP P09_P16 Rail Pwr (out2)" + label curr1 "PMIC-1 12V OSFP P01_P08 Rail Curr (in1)" + label curr2 "PMIC-1 OSFP P01_P8 Rail Curr (out1)" + label curr3 "PMIC-1 OSFP P09_P16 Rail Curr (out2)" + + chip "mp2975-i2c-*-64" + label in1 "PMIC-2 PSU 12V Rail (in1)" + label in2 "PMIC-2 OSFP PORTS_P17_P24 Rail (out1)" + compute in2 (2)*@, @/(2) + label in3 "PMIC-2 OSFP PORTS_P25_P32 Rail (out2)" + compute in3 (2)*@, @/(2) + label temp1 "PMIC-2 OSFP PORTS_P17_P24 Temp 1" + label temp2 "PMIC-2 OSFP PORTS_P25_P32 Temp 2" + label power1 "PMIC-2 12V OSFP PORT_P17_P32 (in)" + label power2 "PMIC-2 OSFP P17_P24 Rail Pwr (out1)" + label power3 "PMIC-2 OSFP P25_P32 Rail Pwr (out2)" + label curr1 "PMIC-2 12V OSFP P17_P24 Rail Curr (in1)" + label curr2 "PMIC-2 OSFP P17_P24 Rail Curr (out1)" + label curr3 "PMIC-2 OSFP P25_P32 Rail Curr (out2)" + + chip "mp2888-i2c-*-66" + label in1 "PMIC-3 PSU 12V Rail (in1)" + label in2 "PMIC-3 ASIC VCORE_MAIN Rail (out1)" + ignore in3 + ignore in4 + label temp1 "PMIC-3 ASIC VCORE_MAIN Temp 1" + ignore temp2 + label power1 "PMIC-3 12V ASIC VCORE_MAIN Rail Pwr (in)" + label power2 "PMIC-3 ASIC VCORE_MAIN Rail Pwr (out1)" + ignore power3 + ignore power4 + label curr1 "PMIC-3 12V ASIC VCORE_MAIN Rail Curr (in1)" + label curr2 "PMIC-3 ASIC VCORE_MAIN Rail Curr (out1)" + ignore curr3 + ignore curr4 + + chip "mp2975-i2c-*-68" + label in1 "PMIC-4 PSU 12V Rail (in)" + label in2 "PMIC-4 HVDD 1.2V EAST Rail (out1)" + label in3 "PMIC-4 DVDD 0.9V EAST Rail (out2)" + label temp1 "PMIC-4 HVDD 1.2V EAST Rail Temp" + label power1 "PMIC-4 12V HVDD_1.2V DVDD_0.9V EAST (in)" + label power2 "PMIC-4 HVDD 1.2V EAST Rail Pwr (out1)" + label power3 "PMIC-4 DVDD 0.9V EAST Rail Pwr (out2)" + label curr1 "PMIC-4 12V HVDD 1.2V EAST Rail Curr (in)" + label curr2 "PMIC-4 HVDD 1.2V EAST Rail Curr (out1)" + label curr3 "PMIC-4 DVDD 0.9V EAST Rail Curr (out2)" + + chip "mp2975-i2c-*-6c" + label in1 "PMIC-5 PSU 12V Rail (in)" + label in2 "PMIC-5 HVDD 1.2V WEST Rail (out1)" + label in3 "PMIC-5 DVDD 0.9V WEST Rail (out2)" + label temp1 "PMIC-5 HVDD 1.2V WEST Rail Temp" + label power1 "PMIC-5 12V HVDD_1.2V DVDD_0.9V WEST (in)" + label power2 "PMIC-5 HVDD 1.2V WEST Rail Pwr (out1)" + label power3 "PMIC-5 DVDD 0.9V WEST Rail Pwr (out2)" + label curr1 "PMIC-5 12V HVDD 1.2V WEST Rail Curr (in)" + label curr2 "PMIC-5 HVDD 1.2V WEST Rail Curr (out1)" + label curr3 "PMIC-5 DVDD 0.9V WEST Rail Curr (out2)" + +bus "i2c-15" "i2c-1-mux (chan_id 6)" + chip "tps53679-i2c-*-58" + label in1 "PMIC-8 PSU 12V Rail (in1)" + label in2 "PMIC-8 PSU 12V Rail (in2)" + label in3 "PMIC-8 COMEX 1.8V Rail (out)" + label in4 "PMIC-8 COMEX 1.05V Rail (out)" + label temp1 "PMIC-8 Temp 1" + label temp2 "PMIC-8 Temp 2" + label power1 "PMIC-8 COMEX 1.8V Rail Pwr (out)" + label power2 "PMIC-8 COMEX 1.05V Rail Pwr (out)" + label curr1 "PMIC-8 COMEX 1.8V Rail Curr (out)" + label curr2 "PMIC-8 COMEX 1.05V Rail Curr (out)" + chip "tps53679-i2c-*-61" + label in1 "PMIC-9 PSU 12V Rail (in1)" + label in2 "PMIC-9 PSU 12V Rail (in2)" + label in3 "PMIC-9 COMEX 1.2V Rail (out)" + ignore in4 + label temp1 "PMIC-9 Temp 1" + label temp2 "PMIC-9 Temp 2" + label power1 "PMIC-9 COMEX 1.2V Rail Pwr (out)" + ignore power2 + label curr1 "PMIC-9 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" + 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" + 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)" + + chip "d1u54p_w_2000_12-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" + 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 "d1u54p_w_2000_12-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" + 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 Tach 1" + label fan2 "Chassis Fan Drawer-1 Tach 2" + label fan3 "Chassis Fan Drawer-2 Tach 1" + label fan4 "Chassis Fan Drawer-2 Tach 2" + label fan5 "Chassis Fan Drawer-3 Tach 1" + label fan6 "Chassis Fan Drawer-3 Tach 2" + label fan7 "Chassis Fan Drawer-4 Tach 1" + label fan8 "Chassis Fan Drawer-4 Tach 2" + label fan9 "Chassis Fan Drawer-5 Tach 1" + label fan10 "Chassis Fan Drawer-5 Tach 2" + label fan11 "Chassis Fan Drawer-6 Tach 1" + label fan12 "Chassis Fan Drawer-6 Tach 2" + label fan13 "Chassis Fan Drawer-7 Tach 1" + label fan14 "Chassis Fan Drawer-7 Tach 2" + +# Miscellaneous +chip "*-virtual-*" + ignore temp1 diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/system_health_monitoring_config.json b/device/mellanox/x86_64-mlnx_msn4800-r0/system_health_monitoring_config.json new file mode 120000 index 000000000000..98df66c27ca5 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800-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-mlnx_msn4800-r0/thermal_policy.json b/device/mellanox/x86_64-mlnx_msn4800-r0/thermal_policy.json new file mode 120000 index 000000000000..5a25cd87f70c --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800-r0/thermal_policy.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/thermal_policy.json \ No newline at end of file From 9b4ed6e6df0c4f3bd04c905b951d3995a900190c Mon Sep 17 00:00:00 2001 From: SeanWu <81406250+seanwu-ec@users.noreply.github.com> Date: Thu, 13 May 2021 03:42:20 +0800 Subject: [PATCH 053/136] [accton] Add sensors.conf to multiple models (#7494) #### Why I did it Improve readability of `show environment` output. #### How I did it In all sensors.conf, give the customized labels according to HW specifications for each model. Signed-off-by: Sean Wu --- .../x86_64-accton_as4630_54pe-r0/sensors.conf | 40 +++++++++++ .../x86_64-accton_as4630_54te-r0/sensors.conf | 40 +++++++++++ .../x86_64-accton_as5712_54x-r0/sensors.conf | 51 ++++++++++++++ .../x86_64-accton_as5812_54t-r0/sensors.conf | 66 ++++++++++++++++++ .../x86_64-accton_as5812_54x-r0/sensors.conf | 31 +++++++++ .../x86_64-accton_as5835_54t-r0/sensors.conf | 50 ++++++++++++++ .../x86_64-accton_as5835_54x-r0/sensors.conf | 51 ++++++++++++++ .../x86_64-accton_as6712_32x-r0/sensors.conf | 67 ++++++++++++++----- .../x86_64-accton_as7315_27xb-r0/sensors.conf | 42 ++++++++++++ .../x86_64-accton_as7326_56x-r0/sensors.conf | 50 ++++++++++++++ .../x86_64-accton_as7712_32x-r0/sensors.conf | 67 +++++++++++++------ .../x86_64-accton_as7716_32x-r0/sensors.conf | 43 ++++++++++++ .../x86_64-accton_as7726_32x-r0/sensors.conf | 49 ++++++++++++++ .../x86_64-accton_as7816_64x-r0/sensors.conf | 51 ++++++++++++++ .../x86_64-accton_as9716_32d-r0/sensors.conf | 59 ++++++++++++++++ 15 files changed, 720 insertions(+), 37 deletions(-) create mode 100644 device/accton/x86_64-accton_as4630_54pe-r0/sensors.conf create mode 100644 device/accton/x86_64-accton_as4630_54te-r0/sensors.conf create mode 100644 device/accton/x86_64-accton_as5712_54x-r0/sensors.conf create mode 100644 device/accton/x86_64-accton_as5812_54t-r0/sensors.conf create mode 100644 device/accton/x86_64-accton_as5812_54x-r0/sensors.conf create mode 100644 device/accton/x86_64-accton_as5835_54t-r0/sensors.conf create mode 100644 device/accton/x86_64-accton_as5835_54x-r0/sensors.conf create mode 100644 device/accton/x86_64-accton_as7315_27xb-r0/sensors.conf create mode 100644 device/accton/x86_64-accton_as7326_56x-r0/sensors.conf create mode 100644 device/accton/x86_64-accton_as7716_32x-r0/sensors.conf create mode 100644 device/accton/x86_64-accton_as7726_32x-r0/sensors.conf create mode 100644 device/accton/x86_64-accton_as7816_64x-r0/sensors.conf create mode 100644 device/accton/x86_64-accton_as9716_32d-r0/sensors.conf diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/sensors.conf b/device/accton/x86_64-accton_as4630_54pe-r0/sensors.conf new file mode 100644 index 000000000000..d34edc0f5a1a --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/sensors.conf @@ -0,0 +1,40 @@ +# libsensors configuration file for as4630-54pe +# ------------------------------------------------ +# + +bus "i2c-3" "i2c-1-mux (chan_id 1)" +bus "i2c-10" "i2c-2-mux (chan_id 0)" +bus "i2c-11" "i2c-2-mux (chan_id 1)" +bus "i2c-14" "i2c-2-mux (chan_id 4)" +bus "i2c-24" "i2c-3-mux (chan_id 6)" +bus "i2c-25" "i2c-3-mux (chan_id 7)" + + +chip "ype1200am-i2c-*-58" + label in3 "PSU 1 Voltage" + label fan1 "PSU 1 Fan" + label temp1 "PSU 1 Temperature" + label power2 "PSU 1 Power" + label curr2 "PSU 1 Current" + +chip "ype1200am-i2c-*-59" + label in3 "PSU 2 Voltage" + label fan1 "PSU 2 Fan" + label temp1 "PSU 2 Temperature" + label power2 "PSU 2 Power" + label curr2 "PSU 2 Current" + +chip "as4630_54pe_cpld-*" + label fan1 "Fan 1" + label fan2 "Fan 2" + label fan3 "Fan 3" + + +chip "lm77-i2c-*-48" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-4a" + label temp1 "Fan Board Temperature" + +chip "lm75-i2c-*-4b" + label temp1 "CPU Board Temperature" diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sensors.conf b/device/accton/x86_64-accton_as4630_54te-r0/sensors.conf new file mode 100644 index 000000000000..b22fff04d027 --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54te-r0/sensors.conf @@ -0,0 +1,40 @@ +# libsensors configuration file for as4630-54te +# ------------------------------------------------ +# + +bus "i2c-3" "i2c-1-mux (chan_id 1)" +bus "i2c-10" "i2c-2-mux (chan_id 0)" +bus "i2c-11" "i2c-2-mux (chan_id 1)" +bus "i2c-14" "i2c-2-mux (chan_id 4)" +bus "i2c-24" "i2c-3-mux (chan_id 6)" +bus "i2c-25" "i2c-3-mux (chan_id 7)" + + +chip "ype1200am-i2c-*-58" + label in3 "PSU 1 Voltage" + label fan1 "PSU 1 Fan" + label temp1 "PSU 1 Temperature" + label power2 "PSU 1 Power" + label curr2 "PSU 1 Current" + +chip "ype1200am-i2c-*-59" + label in3 "PSU 2 Voltage" + label fan1 "PSU 2 Fan" + label temp1 "PSU 2 Temperature" + label power2 "PSU 2 Power" + label curr2 "PSU 2 Current" + +chip "as4630_54te_cpld-*" + label fan1 "Fan 1" + label fan2 "Fan 2" + label fan3 "Fan 3" + + +chip "lm77-i2c-*-48" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-4a" + label temp1 "Fan Board Temperature" + +chip "lm75-i2c-*-4b" + label temp1 "CPU Board Temperature" diff --git a/device/accton/x86_64-accton_as5712_54x-r0/sensors.conf b/device/accton/x86_64-accton_as5712_54x-r0/sensors.conf new file mode 100644 index 000000000000..913022987a6b --- /dev/null +++ b/device/accton/x86_64-accton_as5712_54x-r0/sensors.conf @@ -0,0 +1,51 @@ +# libsensors configuration file for as5712-54x +# ------------------------------------------------ +# + +bus "i2c-57" "i2c-0-mux (chan_id 1)" +bus "i2c-58" "i2c-0-mux (chan_id 2)" +bus "i2c-61" "i2c-0-mux (chan_id 5)" +bus "i2c-62" "i2c-0-mux (chan_id 6)" +bus "i2c-63" "i2c-0-mux (chan_id 7)" + +chip "cpr_4011_4mxx-i2c-*-3c" + label in1 "PSU 1 Voltage In" + label in2 "PSU 1 Voltage Out" + label fan1 "PSU 1 Fan" + label temp1 "PSU 1 Temperature" + label power1 "PSU 1 Power In" + label power2 "PSU 1 Power Out" + label curr1 "PSU 1 Current In" + label curr2 "PSU 1 Current Out" + +chip "cpr_4011_4mxx-i2c-*-3f" + label in1 "PSU 2 Voltage In" + label in2 "PSU 2 Voltage Out" + label fan1 "PSU 2 Fan" + label temp1 "PSU 2 Temperature" + label power1 "PSU 2 Power In" + label power2 "PSU 2 Power Out" + label curr1 "PSU 2 Current In" + label curr2 "PSU 2 Current Out" + +chip "as5712_54x_fan-*" + label fan1 "Fan 1 Front" + label fan2 "Fan 2 Front" + label fan3 "Fan 3 Front" + label fan4 "Fan 4 Front" + label fan5 "Fan 5 Front" + label fan11 "Fan 1 Rear" + label fan12 "Fan 2 Rear" + label fan13 "Fan 3 Rear" + label fan14 "Fan 4 Rear" + label fan15 "Fan 5 Rear" + + +chip "lm75-i2c-*-48" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-49" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-4a" + label temp1 "Main Board Temperature" diff --git a/device/accton/x86_64-accton_as5812_54t-r0/sensors.conf b/device/accton/x86_64-accton_as5812_54t-r0/sensors.conf new file mode 100644 index 000000000000..ebd3e6f8b9e2 --- /dev/null +++ b/device/accton/x86_64-accton_as5812_54t-r0/sensors.conf @@ -0,0 +1,66 @@ +# libsensors configuration file for as5812-54t +# ------------------------------------------------ +# + +bus "i2c-16" "i2c-0-mux (chan_id 6)" +bus "i2c-17" "i2c-0-mux (chan_id 7)" +bus "i2c-11" "i2c-0-mux (chan_id 1)" +bus "i2c-12" "i2c-0-mux (chan_id 2)" +bus "i2c-15" "i2c-0-mux (chan_id 5)" + + +chip "cpr_4011_4mxx-i2c-*-3c" + label in1 "PSU 1 Voltage In" + label in2 "PSU 1 Voltage Out" + label fan1 "PSU 1 Fan" + label temp1 "PSU 1 Temperature" + label power1 "PSU 1 Power In" + label power2 "PSU 1 Power Out" + label curr1 "PSU 1 Current In" + label curr2 "PSU 1 Current Out" + +chip "cpr_4011_4mxx-i2c-*-3f" + label in1 "PSU 2 Voltage In" + label in2 "PSU 2 Voltage Out" + label fan1 "PSU 2 Fan" + label temp1 "PSU 2 Temperature" + label power1 "PSU 2 Power In" + label power2 "PSU 2 Power Out" + label curr1 "PSU 2 Current In" + label curr2 "PSU 2 Current Out" + +chip "ym2401-i2c-*-58" + label in3 "PSU 1 Voltage" + label fan1 "PSU 1 Fan" + label temp1 "PSU 1 Temperature" + label power2 "PSU 1 Power" + label curr2 "PSU 1 Current" + +chip "ym2401-i2c-*-5b" + label in3 "PSU 2 Voltage" + label fan1 "PSU 2 Fan" + label temp1 "PSU 2 Temperature" + label power2 "PSU 2 Power" + label curr2 "PSU 2 Current" + +chip "as5812_54t_fan-*" + label fan1 "Fan 1 Front" + label fan2 "Fan 2 Front" + label fan3 "Fan 3 Front" + label fan4 "Fan 4 Front" + label fan5 "Fan 5 Front" + label fan11 "Fan 1 Rear" + label fan12 "Fan 2 Rear" + label fan13 "Fan 3 Rear" + label fan14 "Fan 4 Rear" + label fan15 "Fan 5 Rear" + + +chip "lm75-i2c-*-48" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-49" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-4a" + label temp1 "Main Board Temperature" diff --git a/device/accton/x86_64-accton_as5812_54x-r0/sensors.conf b/device/accton/x86_64-accton_as5812_54x-r0/sensors.conf new file mode 100644 index 000000000000..73038a4131c2 --- /dev/null +++ b/device/accton/x86_64-accton_as5812_54x-r0/sensors.conf @@ -0,0 +1,31 @@ +# libsensors configuration file for as5812-54x +# ------------------------------------------------ +# + +bus "i2c-57" "i2c-0-mux (chan_id 1)" +bus "i2c-58" "i2c-0-mux (chan_id 2)" +bus "i2c-61" "i2c-0-mux (chan_id 5)" +bus "i2c-62" "i2c-0-mux (chan_id 6)" +bus "i2c-63" "i2c-0-mux (chan_id 7)" + +chip "as5812_54x_fan-*" + label fan1 "Fan 1 Front" + label fan2 "Fan 2 Front" + label fan3 "Fan 3 Front" + label fan4 "Fan 4 Front" + label fan5 "Fan 5 Front" + label fan11 "Fan 1 Rear" + label fan12 "Fan 2 Rear" + label fan13 "Fan 3 Rear" + label fan14 "Fan 4 Rear" + label fan15 "Fan 5 Rear" + + +chip "lm75-i2c-*-48" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-49" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-4a" + label temp1 "Main Board Temperature" diff --git a/device/accton/x86_64-accton_as5835_54t-r0/sensors.conf b/device/accton/x86_64-accton_as5835_54t-r0/sensors.conf new file mode 100644 index 000000000000..3767cafdb580 --- /dev/null +++ b/device/accton/x86_64-accton_as5835_54t-r0/sensors.conf @@ -0,0 +1,50 @@ +# libsensors configuration file for as5835-54t +# ------------------------------------------------ +# + +bus "i2c-3" "i2c-0-mux (chan_id 1)" +bus "i2c-11" "i2c-2-mux (chan_id 1)" +bus "i2c-12" "i2c-2-mux (chan_id 2)" +bus "i2c-18" "i2c-2-mux (chan_id 0)" +bus "i2c-19" "i2c-2-mux (chan_id 1)" +bus "i2c-20" "i2c-2-mux (chan_id 2)" +bus "i2c-21" "i2c-2-mux (chan_id 3)" + +chip "ym2401-i2c-*-58" + label in3 "PSU 1 Voltage" + label fan1 "PSU 1 Fan" + label temp1 "PSU 1 Temperature" + label power2 "PSU 1 Power" + label curr2 "PSU 1 Current" + +chip "ym2401-i2c-*-5b" + label in3 "PSU 2 Voltage" + label fan1 "PSU 2 Fan" + label temp1 "PSU 2 Temperature" + label power2 "PSU 2 Power" + label curr2 "PSU 2 Current" + +chip "as5835_54t_fan-*" + label fan1 "Fan 1 Front" + label fan2 "Fan 2 Front" + label fan3 "Fan 3 Front" + label fan4 "Fan 4 Front" + label fan5 "Fan 5 Front" + label fan11 "Fan 1 Rear" + label fan12 "Fan 2 Rear" + label fan13 "Fan 3 Rear" + label fan14 "Fan 4 Rear" + label fan15 "Fan 5 Rear" + + +chip "lm75-i2c-*-49" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-4a" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-4c" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-4b" + label temp1 "CPU Board Temperature" diff --git a/device/accton/x86_64-accton_as5835_54x-r0/sensors.conf b/device/accton/x86_64-accton_as5835_54x-r0/sensors.conf new file mode 100644 index 000000000000..38cf89fc68c4 --- /dev/null +++ b/device/accton/x86_64-accton_as5835_54x-r0/sensors.conf @@ -0,0 +1,51 @@ +# libsensors configuration file for as5835-54x +# ------------------------------------------------ +# + +bus "i2c-3" "i2c-0-mux (chan_id 1)" +bus "i2c-11" "i2c-2-mux (chan_id 1)" +bus "i2c-12" "i2c-2-mux (chan_id 2)" +bus "i2c-18" "i2c-2-mux (chan_id 0)" +bus "i2c-19" "i2c-2-mux (chan_id 1)" +bus "i2c-20" "i2c-2-mux (chan_id 2)" +bus "i2c-21" "i2c-2-mux (chan_id 3)" + + +chip "ym2401-i2c-*-58" + label in3 "PSU 1 Voltage" + label fan1 "PSU 1 Fan" + label temp1 "PSU 1 Temperature" + label power2 "PSU 1 Power" + label curr2 "PSU 1 Current" + +chip "ym2401-i2c-*-5b" + label in3 "PSU 2 Voltage" + label fan1 "PSU 2 Fan" + label temp1 "PSU 2 Temperature" + label power2 "PSU 2 Power" + label curr2 "PSU 2 Current" + +chip "as5835_54x_fan-*" + label fan1 "Fan 1 Front" + label fan2 "Fan 2 Front" + label fan3 "Fan 3 Front" + label fan4 "Fan 4 Front" + label fan5 "Fan 5 Front" + label fan11 "Fan 1 Rear" + label fan12 "Fan 2 Rear" + label fan13 "Fan 3 Rear" + label fan14 "Fan 4 Rear" + label fan15 "Fan 5 Rear" + + +chip "lm75-i2c-*-49" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-4a" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-4c" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-4b" + label temp1 "CPU Board Temperature" diff --git a/device/accton/x86_64-accton_as6712_32x-r0/sensors.conf b/device/accton/x86_64-accton_as6712_32x-r0/sensors.conf index 84ee0fd9f333..60b8f4734304 100644 --- a/device/accton/x86_64-accton_as6712_32x-r0/sensors.conf +++ b/device/accton/x86_64-accton_as6712_32x-r0/sensors.conf @@ -1,23 +1,56 @@ -# libsensors configuration file for AS6712-32X +# libsensors configuration file for as6712-32x # ------------------------------------------------ +# + +bus "i2c-35" "i2c-0-mux (chan_id 1)" +bus "i2c-36" "i2c-0-mux (chan_id 2)" +bus "i2c-38" "i2c-0-mux (chan_id 4)" +bus "i2c-39" "i2c-0-mux (chan_id 5)" +bus "i2c-40" "i2c-0-mux (chan_id 6)" +bus "i2c-41" "i2c-0-mux (chan_id 7)" + chip "cpr_4011_4mxx-i2c-*-3c" - label in1 "PSU1_VIN" - label in2 "PSU1_VOUT" - label curr1 "PSU1_IIN" - label curr2 "PSU1_IOUT" - label power1 "PSU1_PIN" - label power2 "PSU1_POUT" - label fan1 "PSU1_FAN" - label temp1 "PSU1_TEMP" + label in1 "PSU 1 Voltage In" + label in2 "PSU 1 Voltage Out" + label fan1 "PSU 1 Fan" + label temp1 "PSU 1 Temperature" + label power1 "PSU 1 Power In" + label power2 "PSU 1 Power Out" + label curr1 "PSU 1 Current In" + label curr2 "PSU 1 Current Out" chip "cpr_4011_4mxx-i2c-*-3f" - label in1 "PSU2_VIN" - label in2 "PSU2_VOUT" - label curr1 "PSU2_IIN" - label curr2 "PSU2_IOUT" - label power1 "PSU2_PIN" - label power2 "PSU2_POUT" - label fan1 "PSU2_FAN" - label temp1 "PSU2_TEMP" + label in1 "PSU 2 Voltage In" + label in2 "PSU 2 Voltage Out" + label fan1 "PSU 2 Fan" + label temp1 "PSU 2 Temperature" + label power1 "PSU 2 Power In" + label power2 "PSU 2 Power Out" + label curr1 "PSU 2 Current In" + label curr2 "PSU 2 Current Out" + +chip "as6712_32x_fan-*" + label fan1 "Fan 1 Front" + label fan2 "Fan 2 Front" + label fan3 "Fan 3 Front" + label fan4 "Fan 4 Front" + label fan5 "Fan 5 Front" + label fan11 "Fan 1 Rear" + label fan12 "Fan 2 Rear" + label fan13 "Fan 3 Rear" + label fan14 "Fan 4 Rear" + label fan15 "Fan 5 Rear" + + +chip "lm75-i2c-*-48" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-49" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-4a" + label temp1 "Main Board Temperature" +chip "lm75-i2c-*-4b" + label temp1 "Main Board Temperature" diff --git a/device/accton/x86_64-accton_as7315_27xb-r0/sensors.conf b/device/accton/x86_64-accton_as7315_27xb-r0/sensors.conf new file mode 100644 index 000000000000..1b5c9059c94d --- /dev/null +++ b/device/accton/x86_64-accton_as7315_27xb-r0/sensors.conf @@ -0,0 +1,42 @@ +# libsensors configuration file for as7315-27xb +# ------------------------------------------------ +# + +bus "i2c-12" "i2c-3-mux (chan_id 2)" +bus "i2c-13" "i2c-3-mux (chan_id 3)" +bus "i2c-50" "i2c-7-mux (chan_id 0)" +bus "i2c-51" "i2c-7-mux (chan_id 1)" +bus "i2c-52" "i2c-7-mux (chan_id 2)" +bus "i2c-53" "i2c-7-mux (chan_id 3)" + + +chip "ym2401-i2c-*-5b" + label in3 "PSU 1 Voltage" + label fan1 "PSU 1 Fan" + label temp1 "PSU 1 Temperature" + label power2 "PSU 1 Power" + label curr2 "PSU 1 Current" + +chip "ym2401-i2c-*-58" + label in3 "PSU 2 Voltage" + label fan1 "PSU 2 Fan" + label temp1 "PSU 2 Temperature" + label power2 "PSU 2 Power" + label curr2 "PSU 2 Current" + +chip "as7315_fan-*" + label fan1 "Fan 1" + label fan2 "Fan 2" + label fan3 "Fan 3" + label fan4 "Fan 4" + label fan5 "Fan 5" + + +chip "lm75-i2c-*-49" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-4a" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-4c" + label temp1 "Main Board Temperature" diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sensors.conf b/device/accton/x86_64-accton_as7326_56x-r0/sensors.conf new file mode 100644 index 000000000000..ec28b6875a0c --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/sensors.conf @@ -0,0 +1,50 @@ +# libsensors configuration file for as7326-56x +# ------------------------------------------------ +# + +bus "i2c-11" "i2c-1-mux (chan_id 2)" +bus "i2c-13" "i2c-1-mux (chan_id 4)" +bus "i2c-15" "i2c-1-mux (chan_id 6)" +bus "i2c-17" "i2c-1-mux (chan_id 0)" + + +chip "ym2651-i2c-*-59" + label in3 "PSU 1 Voltage" + label fan1 "PSU 1 Fan" + label temp1 "PSU 1 Temperature" + label power2 "PSU 1 Power" + label curr2 "PSU 1 Current" + +chip "ym2651-i2c-*-5b" + label in3 "PSU 2 Voltage" + label fan1 "PSU 2 Fan" + label temp1 "PSU 2 Temperature" + label power2 "PSU 2 Power" + label curr2 "PSU 2 Current" + +chip "as7326_56x_fan-*" + label fan1 "Fan 1 Front" + label fan2 "Fan 2 Front" + label fan3 "Fan 3 Front" + label fan4 "Fan 4 Front" + label fan5 "Fan 5 Front" + label fan6 "Fan 6 Front" + label fan11 "Fan 1 Rear" + label fan12 "Fan 2 Rear" + label fan13 "Fan 3 Rear" + label fan14 "Fan 4 Rear" + label fan15 "Fan 5 Rear" + label fan16 "Fan 6 Rear" + + +chip "lm75-i2c-*-48" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-49" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-4a" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-4b" + label temp1 "CPU Board Temperature" diff --git a/device/accton/x86_64-accton_as7712_32x-r0/sensors.conf b/device/accton/x86_64-accton_as7712_32x-r0/sensors.conf index 33d75d598123..39796a5c2d13 100644 --- a/device/accton/x86_64-accton_as7712_32x-r0/sensors.conf +++ b/device/accton/x86_64-accton_as7712_32x-r0/sensors.conf @@ -1,23 +1,50 @@ -# libsensors configuration file for AS7712-32X +# libsensors configuration file for as7712-32x # ------------------------------------------------ # -#Comment out the following for sku-sensors-data.yml -#chip "ym2651-*" -# label power1 "PSU Output Power" -# label temp1 "Power Supply Temp" -# label fan1 "Fan Speed" -# -#chip "as7712_32x_fan-*" -# 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 fan5 "Fan tray 5 front" -# label fan6 "Fan tray 6 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" -# label fan15 "Fan tray 5 rear" -# label fan16 "Fan tray 6 rear" +bus "i2c-2" "i2c-1-mux (chan_id 0)" +bus "i2c-3" "i2c-1-mux (chan_id 1)" +bus "i2c-10" "i2c-0-mux (chan_id 0)" +bus "i2c-11" "i2c-0-mux (chan_id 1)" + + +chip "ym2651-i2c-*-5b" + label in3 "PSU 1 Voltage" + label fan1 "PSU 1 Fan" + label temp1 "PSU 1 Temperature" + label power2 "PSU 1 Power" + label curr2 "PSU 1 Current" + +chip "ym2651-i2c-*-58" + label in3 "PSU 2 Voltage" + label fan1 "PSU 2 Fan" + label temp1 "PSU 2 Temperature" + label power2 "PSU 2 Power" + label curr2 "PSU 2 Current" + +chip "as7712_32x_fan-*" + label fan1 "Fan 1 Front" + label fan2 "Fan 2 Front" + label fan3 "Fan 3 Front" + label fan4 "Fan 4 Front" + label fan5 "Fan 5 Front" + label fan6 "Fan 6 Front" + label fan11 "Fan 1 Rear" + label fan12 "Fan 2 Rear" + label fan13 "Fan 3 Rear" + label fan14 "Fan 4 Rear" + label fan15 "Fan 5 Rear" + label fan16 "Fan 6 Rear" + + +chip "lm75-i2c-*-48" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-49" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-4a" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-4b" + label temp1 "CPU Board Temperature" diff --git a/device/accton/x86_64-accton_as7716_32x-r0/sensors.conf b/device/accton/x86_64-accton_as7716_32x-r0/sensors.conf new file mode 100644 index 000000000000..30e5bdbd6003 --- /dev/null +++ b/device/accton/x86_64-accton_as7716_32x-r0/sensors.conf @@ -0,0 +1,43 @@ +# libsensors configuration file for as7716-32x +# ------------------------------------------------ +# + +bus "i2c-9" "i2c-1-mux (chan_id 0)" +bus "i2c-10" "i2c-1-mux (chan_id 1)" +bus "i2c-17" "i2c-2-mux (chan_id 0)" +bus "i2c-18" "i2c-2-mux (chan_id 1)" + + +chip "ym2651-i2c-*-5b" + label fan1 "PSU 1 Fan" + label temp1 "PSU 1 Temperature" + label power1 "PSU 1 Power" + +chip "ym2651-i2c-*-58" + label fan1 "PSU 2 Fan" + label temp1 "PSU 2 Temperature" + label power1 "PSU 2 Power" + +chip "as7716_32x_fan-*" + label fan1 "Fan 1 Front" + label fan2 "Fan 2 Front" + label fan3 "Fan 3 Front" + label fan4 "Fan 4 Front" + label fan5 "Fan 5 Front" + label fan6 "Fan 6 Front" + label fan11 "Fan 1 Rear" + label fan12 "Fan 2 Rear" + label fan13 "Fan 3 Rear" + label fan14 "Fan 4 Rear" + label fan15 "Fan 5 Rear" + label fan16 "Fan 6 Rear" + + +chip "lm75-i2c-*-48" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-49" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-4a" + label temp1 "Main Board Temperature" diff --git a/device/accton/x86_64-accton_as7726_32x-r0/sensors.conf b/device/accton/x86_64-accton_as7726_32x-r0/sensors.conf new file mode 100644 index 000000000000..a7b356ee0b1f --- /dev/null +++ b/device/accton/x86_64-accton_as7726_32x-r0/sensors.conf @@ -0,0 +1,49 @@ +# libsensors configuration file for as7726-32x +# ------------------------------------------------ +# + +bus "i2c-49" "i2c-2-mux (chan_id 0)" +bus "i2c-50" "i2c-2-mux (chan_id 1)" +bus "i2c-54" "i2c-2-mux (chan_id 5)" +bus "i2c-55" "i2c-2-mux (chan_id 6)" + + +chip "ym2651-i2c-*-5b" + label fan1 "PSU 1 Fan" + label temp1 "PSU 1 Temperature" + label power1 "PSU 1 Power" + +chip "ym2651-i2c-*-58" + label fan1 "PSU 2 Fan" + label temp1 "PSU 2 Temperature" + label power1 "PSU 2 Power" + +chip "as7726_32x_fan-*" + label fan1 "Fan 1 Front" + label fan2 "Fan 2 Front" + label fan3 "Fan 3 Front" + label fan4 "Fan 4 Front" + label fan5 "Fan 5 Front" + label fan6 "Fan 6 Front" + label fan11 "Fan 1 Rear" + label fan12 "Fan 2 Rear" + label fan13 "Fan 3 Rear" + label fan14 "Fan 4 Rear" + label fan15 "Fan 5 Rear" + label fan16 "Fan 6 Rear" + + +chip "lm75-i2c-*-48" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-49" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-4a" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-4b" + label temp1 "CPU Board Temperature" + +chip "lm75-i2c-*-4c" + label temp1 "Fan Board Temperature" diff --git a/device/accton/x86_64-accton_as7816_64x-r0/sensors.conf b/device/accton/x86_64-accton_as7816_64x-r0/sensors.conf new file mode 100644 index 000000000000..56e4817a1b51 --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/sensors.conf @@ -0,0 +1,51 @@ +# libsensors configuration file for as7816-64x +# ------------------------------------------------ +# + +bus "i2c-9" "i2c-1-mux (chan_id 0)" +bus "i2c-10" "i2c-1-mux (chan_id 1)" +bus "i2c-17" "i2c-1-mux (chan_id 0)" +bus "i2c-18" "i2c-1-mux (chan_id 1)" + + +chip "ym2851-i2c-*-5b" + label in3 "PSU 1 Voltage" + label fan1 "PSU 1 Fan" + label temp1 "PSU 1 Temperature" + label power2 "PSU 1 Power" + label curr2 "PSU 1 Current" + +chip "ym2851-i2c-*-58" + label in3 "PSU 2 Voltage" + label fan1 "PSU 2 Fan" + label temp1 "PSU 2 Temperature" + label power2 "PSU 2 Power" + label curr2 "PSU 2 Current" + +chip "as7816_64x_fan-*" + label fan1 "Fan 1 Front" + label fan2 "Fan 2 Front" + label fan3 "Fan 3 Front" + label fan4 "Fan 4 Front" + label fan11 "Fan 1 Rear" + label fan12 "Fan 2 Rear" + label fan13 "Fan 3 Rear" + label fan14 "Fan 4 Rear" + +chip "lm75-i2c-*-48" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-49" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-4a" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-4b" + label temp1 "CPU Board Temperature" + +chip "lm75-i2c-*-4d" + label temp1 "Fan Board Temperature" + +chip "lm75-i2c-*-4e" + label temp1 "Fan Board Temperature" diff --git a/device/accton/x86_64-accton_as9716_32d-r0/sensors.conf b/device/accton/x86_64-accton_as9716_32d-r0/sensors.conf new file mode 100644 index 000000000000..d375d2315d5c --- /dev/null +++ b/device/accton/x86_64-accton_as9716_32d-r0/sensors.conf @@ -0,0 +1,59 @@ +# libsensors configuration file for as9716-32d +# ------------------------------------------------ +# + +bus "i2c-9" "i2c-1-mux (chan_id 0)" +bus "i2c-10" "i2c-1-mux (chan_id 1)" +bus "i2c-17" "i2c-1-mux (chan_id 0)" +bus "i2c-18" "i2c-1-mux (chan_id 1)" + + +chip "acbel_fsh082-i2c-*-58" + label in3 "PSU 1 Voltage" + label fan1 "PSU 1 Fan" + label temp1 "PSU 1 Temperature" + label power2 "PSU 1 Power" + label curr2 "PSU 1 Current" + +chip "acbel_fsh082-i2c-*-59" + label in3 "PSU 2 Voltage" + label fan1 "PSU 2 Fan" + label temp1 "PSU 2 Temperature" + label power2 "PSU 2 Power" + label curr2 "PSU 2 Current" + +chip "as9716_32d_fan-*" + label fan1 "Fan 1 Front" + label fan2 "Fan 2 Front" + label fan3 "Fan 3 Front" + label fan4 "Fan 4 Front" + label fan5 "Fan 5 Front" + label fan6 "Fan 6 Front" + label fan11 "Fan 1 Rear" + label fan12 "Fan 2 Rear" + label fan13 "Fan 3 Rear" + label fan14 "Fan 4 Rear" + label fan15 "Fan 5 Rear" + label fan16 "Fan 6 Rear" + + +chip "lm75-i2c-*-48" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-49" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-4a" + label temp1 "Main Board Temperature" + +chip "lm75-i2c-*-4b" + label temp1 "CPU Board Temperature" + +chip "lm75-i2c-*-4c" + label temp1 "OCXO Temperature" + +chip "lm75-i2c-*-4e" + label temp1 "Fan Board Temperature" + +chip "lm75-i2c-*-4f" + label temp1 "Fan Board Temperature" From c265c742578db21ef941972da0f5c4f49c0a0800 Mon Sep 17 00:00:00 2001 From: Junchao-Mellanox <57339448+Junchao-Mellanox@users.noreply.github.com> Date: Thu, 13 May 2021 04:59:03 +0800 Subject: [PATCH 054/136] [sonic-platform-common] Update submodule (#7585) 1213d61 [thermal_manager_base] Add a stop function to thermal manager (#187) a95834b [DeviceBase] Added hardware revision number to generic device properties (#184) f4901a0 [voqinbandif]To support inband port as front panel port (#159) --- src/sonic-platform-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-platform-common b/src/sonic-platform-common index 872f0a306bb8..1213d61136e0 160000 --- a/src/sonic-platform-common +++ b/src/sonic-platform-common @@ -1 +1 @@ -Subproject commit 872f0a306bb8508b1974cebdf62482a25ce7cf1a +Subproject commit 1213d61136e0fd7a193219888ace081b08075620 From aae315faaf1afcc862cd6b2e075711de64bd2b47 Mon Sep 17 00:00:00 2001 From: vmittal-msft <46945843+vmittal-msft@users.noreply.github.com> Date: Wed, 12 May 2021 21:28:19 -0700 Subject: [PATCH 055/136] Updated MMU settings for Arista-7050CX3-32S-C32 T1 topology (#7597) --- .../buffers_defaults_t1.j2 | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/buffers_defaults_t1.j2 diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/buffers_defaults_t1.j2 b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..f5b7327e705d --- /dev/null +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/buffers_defaults_t1.j2 @@ -0,0 +1,46 @@ +{%- set default_cable = '300m' %} + +{%- 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": "32712448", + "type": "ingress", + "mode": "dynamic", + "xoff": "1622016" + }, + "egress_lossy_pool": { + "size": "24709632", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "32599040", + "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", + "static_th":"32599040" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1792", + "dynamic_th":"-1" + } + }, +{%- endmacro %} From 80fe4ed8601dda45d885e7eb4f83feb0b384dcfa Mon Sep 17 00:00:00 2001 From: Shilong Liu Date: Thu, 13 May 2021 22:54:11 +0800 Subject: [PATCH 056/136] [ci]: enable official build in release branch (#7603) Signed-off-by: Shilong Liu --- .azure-pipelines/official-build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.azure-pipelines/official-build.yml b/.azure-pipelines/official-build.yml index fa79be969746..8173753e5aa8 100644 --- a/.azure-pipelines/official-build.yml +++ b/.azure-pipelines/official-build.yml @@ -11,6 +11,12 @@ schedules: - master - 202012 always: true +- cron: "0 4 * * *" + displayName: nightly build for release + branches: + include: + - 201911 + - 201811 trigger: none pr: none From 4123ec94c7e82e1e7f5a74c35fce57f5c3c355d4 Mon Sep 17 00:00:00 2001 From: shlomibitton <60430976+shlomibitton@users.noreply.github.com> Date: Fri, 14 May 2021 06:10:57 +0300 Subject: [PATCH 057/136] Update sonic-swss submodule (#7607) Signed-off-by: Shlomi Bitton --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index d9f28b64255d..73ffd5fc4d26 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit d9f28b64255db54310d3398119f13dfb3203f311 +Subproject commit 73ffd5fc4d2628edf2394fbce9cffedc60fa2fe9 From 7f9276823c0f9b2e2c6a42aba49e82a5fff8d3aa Mon Sep 17 00:00:00 2001 From: shlomibitton <60430976+shlomibitton@users.noreply.github.com> Date: Fri, 14 May 2021 12:25:18 +0300 Subject: [PATCH 058/136] [sonic-utilities] submodule update (#7608) [config]Static routes to config_db (#1534) [DPB]: Shut down interface before dynamic port breakout (#1303) [vlan] remove dhcp-relay as dhcp-relay commands will come as a plugin (#1378) Add 'default' option for sFlow. (#1606) [Command-Reference.md] Document new SNMP show and config commands (#1600) Signed-off-by: Shlomi Bitton --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 9fc630c552d5..ad801bfb8163 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 9fc630c552d5f4cfa89fb9f84f40c975e1de9168 +Subproject commit ad801bfb81633812b4aa25f45bdd555a27121845 From ea80325726cd8b7f5747cf4f2819ab4e8433cfea Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Fri, 14 May 2021 08:58:51 -0700 Subject: [PATCH 059/136] Vxlan src port range for breakout SKU (#7612) *Extended Vxlan src port range for lab breakout SKU - Mellanox-SN3800-D112C8 --- .../x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/sai.profile | 1 + 1 file changed, 1 insertion(+) 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 c5bb0c90f3d7..ab1e27c6aec4 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 +1,2 @@ SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_3800_112x50g_8x100g.xml +SAI_VXLAN_SRCPORT_RANGE_ENABLE=1 From f27aa33e69bc2917184cc3c411f5927fbfa2706e Mon Sep 17 00:00:00 2001 From: abdosi <58047199+abdosi@users.noreply.github.com> Date: Sun, 16 May 2021 19:44:06 -0700 Subject: [PATCH 060/136] [muti-asic] Updated BGP community for Internal routes (#7617) Following changes are done: Internal routes are tagged with no-export instead of local-AS Option to add User Define BGP community on top of no-export --- dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 | 7 ++++++- .../tests/data/sonic-cfggen/bgpd.conf.j2/all.conf | 6 +++++- .../tests/data/sonic-cfggen/bgpd.conf.j2/all.json | 5 +++++ .../tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf | 3 ++- .../data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf | 3 ++- .../tests/data/sonic-cfggen/frr.conf.j2/all.conf | 2 +- .../tests/sample_output/py2/bgpd_frr_backend_asic.conf | 2 +- .../tests/sample_output/py2/bgpd_frr_frontend_asic.conf | 2 +- .../tests/sample_output/py3/bgpd_frr_backend_asic.conf | 2 +- .../tests/sample_output/py3/bgpd_frr_frontend_asic.conf | 2 +- 10 files changed, 25 insertions(+), 9 deletions(-) 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 cf0b0f0077c6..82138f6ff515 100644 --- a/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 +++ b/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 @@ -32,7 +32,12 @@ 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' %} route-map HIDE_INTERNAL permit 10 - set community local-AS + 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 %} + on-match next +route-map HIDE_INTERNAL permit 20 + set community {{ constants.bgp.peers.internal.community }} additive +{% endif %} {% set multi_asic = True %} ! {% endif %} 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 e2f9964766c1..018ddd36bfc4 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 @@ -34,7 +34,11 @@ 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 ! route-map HIDE_INTERNAL permit 10 - set community local-AS + set community no-export + on-match next +route-map HIDE_INTERNAL permit 20 + set community 1234:5678 additive +! ! router bgp 55555 ! 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 bc266ed70429..34fdbe72448b 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 @@ -29,6 +29,11 @@ "enabled": true, "ipv4": 32, "ipv6": 32 + }, + "peers": { + "internal": { + "community": "1234:5678" + } } } } 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 c7f2971fd7c0..459f3fda2b31 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 @@ -16,7 +16,8 @@ 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 ! route-map HIDE_INTERNAL permit 10 - set community local-AS + set community no-export +! ! router bgp 55555 ! 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 431499ceaf92..19e06170a151 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 @@ -16,7 +16,8 @@ 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 ! route-map HIDE_INTERNAL permit 10 - set community local-AS + set community no-export +! ! router bgp 55555 ! 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 e977d2b5cffc..760569239406 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 @@ -57,7 +57,7 @@ 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 ! route-map HIDE_INTERNAL permit 10 - set community local-AS + set community no-export ! router bgp 55555 ! 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 ce4f4d7ce23f..99aeef2457c0 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 @@ -35,7 +35,7 @@ ipv6 prefix-list PL_LoopbackV6 permit fc00:1::/64 ! ! route-map HIDE_INTERNAL permit 10 - set community local-AS + set community no-export ! ! router bgp 65100 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 dcdcc78af033..abb6761e9ea5 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 @@ -35,7 +35,7 @@ ipv6 prefix-list PL_LoopbackV6 permit fc00:1::/64 ! ! route-map HIDE_INTERNAL permit 10 - set community local-AS + set community no-export ! ! router bgp 65100 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 ce4f4d7ce23f..99aeef2457c0 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 @@ -35,7 +35,7 @@ ipv6 prefix-list PL_LoopbackV6 permit fc00:1::/64 ! ! route-map HIDE_INTERNAL permit 10 - set community local-AS + set community no-export ! ! router bgp 65100 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 dcdcc78af033..abb6761e9ea5 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 @@ -35,7 +35,7 @@ ipv6 prefix-list PL_LoopbackV6 permit fc00:1::/64 ! ! route-map HIDE_INTERNAL permit 10 - set community local-AS + set community no-export ! ! router bgp 65100 From ef7bde18b9e0d44ee854ed686d122767bae41097 Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Tue, 18 May 2021 14:28:32 +0800 Subject: [PATCH 061/136] Skip the web proxy when downloading from proxy endpoint (#7592) Why I did it Skip to use the web proxy when the packages have been in the proxy server. For sai packages or the other packages, we will upload the the proxy server directly, the reproducible will skip to check the site, not necessary to change the version files. --- src/sonic-build-hooks/scripts/buildinfo_base.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/sonic-build-hooks/scripts/buildinfo_base.sh b/src/sonic-build-hooks/scripts/buildinfo_base.sh index ae85c2dcf129..cc3d7aedf8bc 100755 --- a/src/sonic-build-hooks/scripts/buildinfo_base.sh +++ b/src/sonic-build-hooks/scripts/buildinfo_base.sh @@ -71,6 +71,12 @@ download_packages() if [[ "$para" == *://* ]]; then local url=$para local real_version= + + # Skip to use the proxy, if the url has already used the proxy server + if [[ $url == ${URL_PREFIX}* ]]; then + continue + fi + if [ "$ENABLE_VERSION_CONTROL_WEB" == y ]; then local version= local filename=$(echo $url | awk -F"/" '{print $NF}' | cut -d? -f1 | cut -d# -f1) From cbfbc4046cbc324905c7c546b3e3dd826d9e4c99 Mon Sep 17 00:00:00 2001 From: vdahiya12 <67608553+vdahiya12@users.noreply.github.com> Date: Tue, 18 May 2021 08:31:13 -0700 Subject: [PATCH 062/136] [sonic-platform-daemons] submodule update (#7631) This PR updates the following commits in sonic-platform-daemons e60804c [xcvrd] add support for logging mux_metrics events into state DB (#185) 807b304 [psud] Add PSU Hardware Revision to Redis STATE_DB (#179) d0be634 [muxcable] Remove Xcvrd Sleep (#174) cc3803f [thermalctld] Enable stopping thermal manager (#180) 665fcd9 [xcvrd] Fix crash for QSFP DD media (#181) cdabd09 [xcvrd] Change the y_cable presence logic to use "mux_cable" table as identifier from Config DB (#176) 4be4306 [xcvrd] Enhance Media Settings (#177) Signed-off-by: vaibhav-dahiya --- src/sonic-platform-daemons | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-platform-daemons b/src/sonic-platform-daemons index 911601dfb174..e60804cd8230 160000 --- a/src/sonic-platform-daemons +++ b/src/sonic-platform-daemons @@ -1 +1 @@ -Subproject commit 911601dfb17403f01bb2340f97b69ad57c2c2cb3 +Subproject commit e60804cd823090291ad1032e2ef3e9edb11d5a65 From b1a7f670d74c46641067b78e4e41bc2788ee5dae Mon Sep 17 00:00:00 2001 From: tomer-israel <76040066+tomer-israel@users.noreply.github.com> Date: Tue, 18 May 2021 19:34:33 +0300 Subject: [PATCH 063/136] [Mellanox] Add initial support for SN4800 for simulation device (#7448) #### Why I did it Add initial support of SN4800 platform for Mellanox ASIC simulation device. NOTE: This is work in progress and not full support of the platform. #### How I did it Add new folders for SN4800 with zero ports based on SN4700 Spectrum-3 switch. --- .../x86_64-mlnx_msn4800_simx-r0/ACS-MSN4800 | 1 + .../x86_64-mlnx_msn4800_simx-r0/default_sku | 1 + .../platform_reboot | 1 + .../x86_64-mlnx_msn4800_simx-r0/plugins | 1 + .../pmon_daemon_control.json | 7 + .../x86_64-mlnx_msn4800_simx-r0/syseeprom.hex | 256 ++++++++++++++++++ .../system_health_monitoring_config.json | 1 + 7 files changed, 268 insertions(+) create mode 120000 device/mellanox/x86_64-mlnx_msn4800_simx-r0/ACS-MSN4800 create mode 120000 device/mellanox/x86_64-mlnx_msn4800_simx-r0/default_sku create mode 120000 device/mellanox/x86_64-mlnx_msn4800_simx-r0/platform_reboot create mode 120000 device/mellanox/x86_64-mlnx_msn4800_simx-r0/plugins create mode 100644 device/mellanox/x86_64-mlnx_msn4800_simx-r0/pmon_daemon_control.json create mode 100644 device/mellanox/x86_64-mlnx_msn4800_simx-r0/syseeprom.hex create mode 120000 device/mellanox/x86_64-mlnx_msn4800_simx-r0/system_health_monitoring_config.json diff --git a/device/mellanox/x86_64-mlnx_msn4800_simx-r0/ACS-MSN4800 b/device/mellanox/x86_64-mlnx_msn4800_simx-r0/ACS-MSN4800 new file mode 120000 index 000000000000..c91b607a31cc --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800_simx-r0/ACS-MSN4800 @@ -0,0 +1 @@ +../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 new file mode 120000 index 000000000000..a81dbe5c2475 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800_simx-r0/default_sku @@ -0,0 +1 @@ +../x86_64-mlnx_msn4800-r0/default_sku \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4800_simx-r0/platform_reboot b/device/mellanox/x86_64-mlnx_msn4800_simx-r0/platform_reboot new file mode 120000 index 000000000000..dfaf53417665 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800_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-mlnx_msn4800_simx-r0/plugins b/device/mellanox/x86_64-mlnx_msn4800_simx-r0/plugins new file mode 120000 index 000000000000..92912a201dd1 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800_simx-r0/plugins @@ -0,0 +1 @@ +../x86_64-mlnx_msn4800-r0/plugins/ \ 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-mlnx_msn4800_simx-r0/pmon_daemon_control.json new file mode 100644 index 000000000000..dd83c2db12c5 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800_simx-r0/pmon_daemon_control.json @@ -0,0 +1,7 @@ +{ + "skip_ledd": true, + "skip_xcvrd": true, + "skip_psud": true, + "skip_pcied": true, + "skip_thermalctld": true +} diff --git a/device/mellanox/x86_64-mlnx_msn4800_simx-r0/syseeprom.hex b/device/mellanox/x86_64-mlnx_msn4800_simx-r0/syseeprom.hex new file mode 100644 index 000000000000..b50ffa5a0231 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800_simx-r0/syseeprom.hex @@ -0,0 +1,256 @@ +54 6c 76 49 6e 66 6f 00 01 02 53 21 40 4d 53 4e +33 37 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 00 00 00 00 00 00 22 14 4d +53 4e 33 37 30 30 2d 56 53 32 46 00 00 00 00 00 +00 00 00 23 18 4d 54 31 38 35 31 58 30 32 39 36 +31 00 00 00 00 00 00 00 00 00 00 00 00 24 06 98 +03 9b 94 d4 80 25 13 31 32 2f 32 38 2f 32 30 31 +38 20 30 34 3a 34 32 3a 31 38 26 01 00 2a 02 00 +fe 2b 08 4d 65 6c 6c 61 6e 6f 78 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 01 00 00 4d +54 31 38 35 31 58 30 32 39 36 31 00 00 00 00 00 +00 00 00 00 00 00 00 4d 53 4e 33 37 30 30 2d 56 +53 32 46 00 00 00 00 00 00 00 00 41 32 00 00 00 +3a 82 b8 41 6e 61 63 6f 6e 64 61 20 45 74 68 20 +32 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 70 00 00 00 0e 74 4d 53 4e 33 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 85 00 00 0d 00 00 00 00 +00 00 00 98 03 9b 94 d4 80 00 fe 98 03 9b 03 00 +94 d4 80 fd 24 00 00 81 19 00 12 00 01 06 81 00 +00 00 46 00 00 08 00 06 06 06 06 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 28 +40 78 38 36 5f 36 34 2d 6d 6c 6e 78 5f 6d 73 6e +33 37 30 30 2d 72 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 29 15 32 30 31 38 2e 31 31 2d 35 2e 32 2e 30 +30 30 38 2d 39 36 30 30 fe 04 89 cb 82 5b 00 00 +00 00 00 fe 04 72 60 7f 13 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 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-mlnx_msn4800_simx-r0/system_health_monitoring_config.json b/device/mellanox/x86_64-mlnx_msn4800_simx-r0/system_health_monitoring_config.json new file mode 120000 index 000000000000..42fe945344c9 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4800_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 From f783aefd6d782a4683a1c820585746cc737f8894 Mon Sep 17 00:00:00 2001 From: sudhanshukumar22 <51457531+sudhanshukumar22@users.noreply.github.com> Date: Tue, 18 May 2021 22:21:02 +0530 Subject: [PATCH 064/136] docker-lldp:intermittent DB errors will result in Client termination (#6119) This PR allows listen to hostname changes and mgmt ip changes. --- dockers/docker-lldp/lldpmgrd | 113 +++++++++++++++++++++++++++++++++-- 1 file changed, 107 insertions(+), 6 deletions(-) diff --git a/dockers/docker-lldp/lldpmgrd b/dockers/docker-lldp/lldpmgrd index 2cf73408f419..0902822af01c 100755 --- a/dockers/docker-lldp/lldpmgrd +++ b/dockers/docker-lldp/lldpmgrd @@ -51,14 +51,51 @@ class LldpManager(daemon_base.DaemonBase): # Open a handle to the Config database self.config_db = swsscommon.DBConnector("CONFIG_DB", self.REDIS_TIMEOUT_MS, - True) + False) # Open a handle to the Application database self.appl_db = swsscommon.DBConnector("APPL_DB", self.REDIS_TIMEOUT_MS, - True) + False) self.pending_cmds = {} + self.hostname = "None" + self.mgmt_ip = "None" + + self.device_table = swsscommon.Table(self.config_db, swsscommon.CFG_DEVICE_METADATA_TABLE_NAME) + 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) + + def update_hostname(self, hostname): + cmd = "lldpcli configure system hostname {0}".format(hostname) + self.log_debug("Running command: '{}'".format(cmd)) + + proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + (stdout, stderr) = proc.communicate() + + if proc.returncode != 0: + log_warning("Command failed '{}': {}".format(cmd, stderr)) + else: + self.hostname = hostname + + def update_mgmt_addr(self, ip): + if ip == "None": + cmd = "lldpcli unconfigure system ip management pattern" + self.log_info("Mgmt IP {0} deleted".format(self.mgmt_ip)) + else: + cmd = "lldpcli configure system ip management pattern {0}".format(ip) + self.log_info("Mgmt IP changed old ip {0}, new ip {1}".format(self.mgmt_ip, ip)) + + self.log_debug("Running command: '{}'".format(cmd)) + + proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + (stdout, stderr) = proc.communicate() + + if proc.returncode != 0: + log_warning("Command failed '{}': {}".format(cmd, stderr)) + else: + self.mgmt_ip = ip def is_port_up(self, port_name): """ @@ -66,8 +103,7 @@ class LldpManager(daemon_base.DaemonBase): PORT TABLE in the Application DB """ # Retrieve all entires for this port from the Port table - port_table = swsscommon.Table(self.appl_db, swsscommon.APP_PORT_TABLE_NAME) - (status, fvp) = port_table.get(port_name) + (status, fvp) = self.app_port_table.get(port_name) if status: # Convert list of tuples to a dictionary port_table_dict = dict(fvp) @@ -101,8 +137,7 @@ class LldpManager(daemon_base.DaemonBase): return # Retrieve all entires for this port from the Port table - port_table = swsscommon.Table(self.config_db, swsscommon.CFG_PORT_TABLE_NAME) - (status, fvp) = port_table.get(port_name) + (status, fvp) = self.port_table.get(port_name) if status: # Convert list of tuples to a dictionary port_table_dict = dict(fvp) @@ -156,6 +191,56 @@ class LldpManager(daemon_base.DaemonBase): for port_name in to_delete: self.pending_cmds.pop(port_name, None) + def lldp_get_mgmt_ip(self): + mgmt_intf_keys = self.mgmt_table.getKeys() + ipv4_addr = "None" + ipv6_addr = "None" + for key in mgmt_intf_keys: + if '|' in key: + key = key.split('|', 1) + if '/' in key[1]: + ip = key[1].split('/', 1) + if self.mgmt_ip != ip[0]: + if '.' in ip[0]: + ipv4_addr = ip[0] + else: + ipv6_addr = ip[0] + + if ipv4_addr != "None": + return ipv4_addr + elif ipv6_addr != "None": + return ipv6_addr + else: + return "None" + + def lldp_process_mgmt_info_change(self, op, mgmt_dict, key): + if not op in ["SET", "DEL"]: + return + self.log_info("Mgmt Config Opcode: {} Dict {} Key {} Curr {}".format(op, mgmt_dict, key, self.mgmt_ip)) + if '|' in key: + key = key.split('|', 1) + if '/' in key[1]: + ip = key[1].split('/', 1) + if op == "DEL": + if self.mgmt_ip == ip[0]: + ip_addr = self.lldp_get_mgmt_ip() + self.update_mgmt_addr(ip_addr) + else: + if not self.mgmt_ip == ip[0]: + if '.' in ip[0]: + self.update_mgmt_addr(ip[0]) + elif '.' not in self.mgmt_ip: + self.update_mgmt_addr(ip[0]) + + def lldp_process_device_table_event(self, op, device_dict, key): + if not op in ["SET", "DEL"]: + return + self.log_info("Device Config Opcode: {} Dict {} Key {}".format(op, device_dict, key)) + hostname = device_dict.get("hostname") + if not self.hostname == hostname: + self.log_info("Hostname changed old {0}, new {1}".format(self.hostname, hostname)) + self.update_hostname(hostname) + def run(self): """ Subscribes to notifications of changes in the PORT table @@ -190,6 +275,14 @@ class LldpManager(daemon_base.DaemonBase): # 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) + + # Subscribe to MGMT PORT table notifications in the Config DB + sst_mgmt_ip_confdb = swsscommon.SubscriberStateTable(self.config_db, swsscommon.CFG_MGMT_INTERFACE_TABLE_NAME) + sel.addSelectable(sst_mgmt_ip_confdb) + + # Subscribe to DEVICE_METADATA table notifications in the Config DB + sst_device_confdb = swsscommon.SubscriberStateTable(self.config_db, swsscommon.CFG_DEVICE_METADATA_TABLE_NAME) + sel.addSelectable(sst_device_confdb) # Listen for changes to the PORT table in the CONFIG_DB and APP_DB while True: @@ -207,6 +300,14 @@ class LldpManager(daemon_base.DaemonBase): 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) + + (key, op, fvp) = sst_device_confdb.pop() + if key: + self.lldp_process_device_table_event(op, dict(fvp), key) + (key, op, fvp) = sst_appdb.pop() if (key != "PortInitDone") and (key != "PortConfigDone"): if fvp: From 359c6bb9d19e0d4ceb4133d3942a57d687b0f77a Mon Sep 17 00:00:00 2001 From: Shi Su <67605788+shi-su@users.noreply.github.com> Date: Tue, 18 May 2021 10:55:46 -0700 Subject: [PATCH 065/136] [bgpcfgd] Redistribute static routes (#7492) Why I did it Enable redistribution of static routes How I did it Enable redistribution of static routes when the first route is added to STATIC_ROUTE table of Config_DB and disable the redistribution when the last route is removed from STATIC_ROUTE table. --- .../bgpcfgd/managers_static_rt.py | 27 +++- src/sonic-bgpcfgd/tests/test_static_rt.py | 126 +++++++++++++++--- 2 files changed, 133 insertions(+), 20 deletions(-) diff --git a/src/sonic-bgpcfgd/bgpcfgd/managers_static_rt.py b/src/sonic-bgpcfgd/bgpcfgd/managers_static_rt.py index f6dd77a520d2..974843366a90 100644 --- a/src/sonic-bgpcfgd/bgpcfgd/managers_static_rt.py +++ b/src/sonic-bgpcfgd/bgpcfgd/managers_static_rt.py @@ -3,6 +3,7 @@ from .manager import Manager from .template import TemplateFabric import socket +from swsscommon import swsscommon class StaticRouteMgr(Manager): """ This class updates static routes when STATIC_ROUTE table is updated """ @@ -15,7 +16,7 @@ def __init__(self, common_objs, db, table): """ super(StaticRouteMgr, self).__init__( common_objs, - [], + [("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME, "localhost/bgp_asn"),], db, table, ) @@ -44,6 +45,18 @@ def set_handler(self, key, data): log_crit("Got an exception %s: Traceback: %s" % (str(exc), traceback.format_exc())) return False + # Enable redistribution of static routes when it is the first one get set + if not self.static_routes.get(vrf, {}): + log_debug("Enabling static route redistribution") + 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) + else: + 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") + if cmd_list: self.cfg_mgr.push_list(cmd_list) log_debug("Static route {} is scheduled for updates".format(key)) @@ -63,6 +76,18 @@ def del_handler(self, key): 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) + # Disable redistribution of static routes when it is the last one to delete + if self.static_routes.get(vrf, {}).keys() == {ip_prefix}: + log_debug("Disabling static route redistribution") + 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) + else: + 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") + if cmd_list: self.cfg_mgr.push_list(cmd_list) log_debug("Static route {} is scheduled for updates".format(key)) diff --git a/src/sonic-bgpcfgd/tests/test_static_rt.py b/src/sonic-bgpcfgd/tests/test_static_rt.py index c6a3e40fab48..0fa2e3df6c2f 100644 --- a/src/sonic-bgpcfgd/tests/test_static_rt.py +++ b/src/sonic-bgpcfgd/tests/test_static_rt.py @@ -4,6 +4,7 @@ from bgpcfgd.template import TemplateFabric from bgpcfgd.managers_static_rt import StaticRouteMgr from collections import Counter +from swsscommon import swsscommon def constructor(): cfg_mgr = MagicMock() @@ -16,6 +17,7 @@ def constructor(): } mgr = StaticRouteMgr(common_objs, "CONFIG_DB", "STATIC_ROUTE") + mgr.directory.put("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME, "localhost", {"bgp_asn": "65100"}) assert len(mgr.static_routes) == 0 return mgr @@ -28,9 +30,9 @@ def push_list(cmds): max_del_idx = -1 min_set_idx = len(cmds) for idx in range(len(cmds)): - if cmds[idx].startswith('no') and idx > max_del_idx: + if cmds[idx].startswith('no ip') and idx > max_del_idx: max_del_idx = idx - if not cmds[idx].startswith('no') and idx < min_set_idx: + if cmds[idx].startswith('ip') and idx < min_set_idx: min_set_idx = idx assert max_del_idx < min_set_idx, "DEL command comes after SET command" # DEL commands should be done first return True @@ -59,7 +61,12 @@ 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", + "router bgp 65100", + " address-family ipv4", + " redistribute static", + " address-family ipv6", + " redistribute static" ] ) @@ -77,7 +84,12 @@ 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", + "router bgp 65100", + " address-family ipv4", + " redistribute static", + " address-family ipv6", + " redistribute static" ] ) @@ -95,7 +107,12 @@ def test_set_blackhole(): }), True, [ - "ip route 10.1.2.0/24 blackhole 10" + "ip route 10.1.2.0/24 blackhole 10", + "router bgp 65100", + " address-family ipv4", + " redistribute static", + " address-family ipv6", + " redistribute static" ] ) @@ -113,7 +130,12 @@ 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", + "router bgp 65100 vrf vrfRED", + " address-family ipv4", + " redistribute static", + " address-family ipv6", + " redistribute static" ] ) @@ -131,7 +153,12 @@ def test_set_ipv6(): }), True, [ - "ipv6 route fc00:10::/64 fc00::72 PortChannel0001 10" + "ipv6 route fc00:10::/64 fc00::72 PortChannel0001 10", + "router bgp 65100", + " address-family ipv4", + " redistribute static", + " address-family ipv6", + " redistribute static" ] ) @@ -150,7 +177,12 @@ def test_set_nh_only(): [ "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.61 30 nexthop-vrf default vrf vrfRED", + "router bgp 65100 vrf vrfRED", + " address-family ipv4", + " redistribute static", + " address-family ipv6", + " redistribute static" ] ) @@ -169,7 +201,12 @@ def test_set_ifname_only(): [ "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 PortChannel0003 30 nexthop-vrf default vrf vrfRED", + "router bgp 65100 vrf vrfRED", + " address-family ipv4", + " redistribute static", + " address-family ipv6", + " redistribute static" ] ) @@ -189,7 +226,12 @@ def test_set_with_empty_ifname(): [ "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.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED", + "router bgp 65100 vrf vrfRED", + " address-family ipv4", + " redistribute static", + " address-family ipv6", + " redistribute static" ] ) @@ -209,7 +251,12 @@ def test_set_with_empty_nh(): [ "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 PortChannel0003 30 nexthop-vrf default vrf vrfRED", + "router bgp 65100 vrf vrfRED", + " address-family ipv4", + " redistribute static", + " address-family ipv6", + " redistribute static" ] ) @@ -229,7 +276,12 @@ def test_set_del(): [ "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.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED", + "router bgp 65100 vrf vrfRED", + " address-family ipv4", + " redistribute static", + " address-family ipv6", + " redistribute static" ] ) set_del_test( @@ -240,7 +292,12 @@ def test_set_del(): [ "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.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED", + "router bgp 65100 vrf vrfRED", + " address-family ipv4", + " no redistribute static", + " address-family ipv6", + " no redistribute static" ] ) set_del_test( @@ -257,7 +314,12 @@ def test_set_del(): [ "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.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED", + "router bgp 65100 vrf vrfRED", + " address-family ipv4", + " redistribute static", + " address-family ipv6", + " redistribute static" ] ) @@ -277,7 +339,12 @@ def test_set_same_route(): [ "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.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED", + "router bgp 65100 vrf vrfRED", + " address-family ipv4", + " redistribute static", + " address-family ipv6", + " redistribute static" ] ) set_del_test( @@ -317,7 +384,12 @@ def test_set_add_del_nh(): [ "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.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED", + "router bgp 65100 vrf vrfRED", + " address-family ipv4", + " redistribute static", + " address-family ipv6", + " redistribute static" ] ) set_del_test( @@ -368,7 +440,12 @@ def test_set_add_del_nh_ethernet(): [ "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.61 Ethernet12 30 nexthop-vrf default", + "router bgp 65100", + " address-family ipv4", + " redistribute static", + " address-family ipv6", + " redistribute static" ] ) set_del_test( @@ -416,7 +493,12 @@ 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", + "router bgp 65100", + " address-family ipv4", + " redistribute static", + " address-family ipv6", + " redistribute static" ] ) @@ -470,7 +552,13 @@ def test_set_invalid_blackhole(mocked_log_err): "blackhole": "false", }), True, - [] + [ + "router bgp 65100", + " address-family ipv4", + " redistribute static", + " address-family ipv6", + " redistribute static" + ] ) mocked_log_err.assert_called_with("Mandatory attribute not found for nexthop") From 8f883fee674eaa4c5bfe8d5649c709cb7c42a66f Mon Sep 17 00:00:00 2001 From: Ze Gan Date: Wed, 19 May 2021 02:44:21 +0800 Subject: [PATCH 066/136] [macsec]: Bind macsec service to sonic.target (#7642) MACsec service cannot be enabled by "sudo config feature state macsec enabled" Signed-off-by: Ze Gan --- files/build_templates/macsec.service.j2 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/files/build_templates/macsec.service.j2 b/files/build_templates/macsec.service.j2 index 85229d1aea10..b8ffbafcbd2c 100644 --- a/files/build_templates/macsec.service.j2 +++ b/files/build_templates/macsec.service.j2 @@ -2,6 +2,8 @@ Description=MACsec container Requires=swss.service After=swss.service syncd.service +BindsTo=sonic.target +After=sonic.target StartLimitIntervalSec=1200 StartLimitBurst=3 @@ -14,4 +16,4 @@ Restart=always RestartSec=30 [Install] -WantedBy=multi-user.target \ No newline at end of file +WantedBy=sonic.target \ No newline at end of file From 8e44b9e38ea46d9120cc5134c7950c9ef74d679e Mon Sep 17 00:00:00 2001 From: ChiouRung Haung Date: Wed, 19 May 2021 04:16:02 +0800 Subject: [PATCH 067/136] [Minipack] Modify fbfpgaiomodule.c to support both python2 and python3 (#7604) Modify fbfpgaiomodule.c to support both python2 and python3 Signed-off-by: chiourung_huang --- .../minipack/lib/fbfpgaiomodule.c | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sonic-platform-modules-accton/minipack/lib/fbfpgaiomodule.c b/platform/broadcom/sonic-platform-modules-accton/minipack/lib/fbfpgaiomodule.c index 036eb95c944a..f5f8c8235fc5 100755 --- a/platform/broadcom/sonic-platform-modules-accton/minipack/lib/fbfpgaiomodule.c +++ b/platform/broadcom/sonic-platform-modules-accton/minipack/lib/fbfpgaiomodule.c @@ -109,10 +109,7 @@ static PyMethodDef FbfpgaMethods[] = { { NULL, NULL, 0, NULL }, }; -PyMODINIT_FUNC -initfbfpgaio(void) -{ - char docstr[] = "\ +static char docstr[] = "\ 1. hw_init():\n\ return value: True/False\n\ 2. hw_release():\n\ @@ -122,5 +119,26 @@ initfbfpgaio(void) In reading operation: data which is read from FPGA\n\ In writing operation: None\n"; +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC +initfbfpgaio(void) +{ (void) Py_InitModule3("fbfpgaio", FbfpgaMethods, docstr); } +#else +static struct PyModuleDef FbfpgaModule = +{ + PyModuleDef_HEAD_INIT, + "fbfpgaio", /* name of module */ + docstr, + -1, /* size of per-interpreter state of the module, or -1 if the module keeps state in global variables. */ + FbfpgaMethods +}; + +PyMODINIT_FUNC +PyInit_fbfpgaio(void) +{ + return PyModule_Create(&FbfpgaModule); +} +#endif + From c6462577a9957fd7a6f41b681c8139e59bd30061 Mon Sep 17 00:00:00 2001 From: Sujin Kang Date: Tue, 18 May 2021 14:19:02 -0700 Subject: [PATCH 068/136] add config-setup.service as dependency for pcie-check.service (#7599) Why I did it start pcie-check.service after config-setup.service since pcie_util depends on device_info which is available with config db metadata. How I did it Add config-setup.service as a dependency of pcie-check.service How to verify it Upon reboot, check if the pcie-check.sh throws the platform api error which is dependent on DEVICE_METADATA --- files/image_config/pcie-check/pcie-check.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/image_config/pcie-check/pcie-check.service b/files/image_config/pcie-check/pcie-check.service index 9df04ea840bc..03c57e28b537 100644 --- a/files/image_config/pcie-check/pcie-check.service +++ b/files/image_config/pcie-check/pcie-check.service @@ -1,6 +1,6 @@ [Unit] Description=Check the PCIe device presence and status -After=rc.local.service database.service +After=rc.local.service database.service config-setup.service [Service] Type=simple From ea913fe3c62e0453e2668ddd6a5ca0c6f48cb069 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 19 May 2021 14:54:14 -0700 Subject: [PATCH 069/136] [sonic-utilities] submodule update (#7653) Includes below commits ``` 00bd0ce 2021-05-18 | Limit pyroute2 version range due to upstream broken (#1622) [Qi Luo] ``` --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index ad801bfb8163..00bd0cea4f26 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit ad801bfb81633812b4aa25f45bdd555a27121845 +Subproject commit 00bd0cea4f260ca8cecc382a6bcea05272dfd070 From a9f6413eb5d553acbd1f24d16a0403f61273d3f4 Mon Sep 17 00:00:00 2001 From: Neetha John Date: Thu, 20 May 2021 05:51:05 -0700 Subject: [PATCH 070/136] [bgpcfgd] Enable BGP sessions over subinterfaces (#7654) Signed-off-by: Neetha John nejo@microsoft.com Fixes #7531 Why I did it To enable bgp sessions to be established over subinterfaces How I did it Listen to VLAN_SUB_INTERFACE table in config db How to verify it Bgp sessions were established successfully over subinterface --- src/sonic-bgpcfgd/bgpcfgd/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sonic-bgpcfgd/bgpcfgd/main.py b/src/sonic-bgpcfgd/bgpcfgd/main.py index 8b0fe0fb3b56..6442e0299217 100644 --- a/src/sonic-bgpcfgd/bgpcfgd/main.py +++ b/src/sonic-bgpcfgd/bgpcfgd/main.py @@ -44,6 +44,7 @@ def do_work(): InterfaceMgr(common_objs, "CONFIG_DB", swsscommon.CFG_VLAN_INTF_TABLE_NAME), InterfaceMgr(common_objs, "CONFIG_DB", swsscommon.CFG_LAG_INTF_TABLE_NAME), InterfaceMgr(common_objs, "CONFIG_DB", swsscommon.CFG_VOQ_INBAND_INTERFACE_TABLE_NAME), + InterfaceMgr(common_objs, "CONFIG_DB", swsscommon.CFG_VLAN_SUB_INTF_TABLE_NAME), # State DB managers ZebraSetSrc(common_objs, "STATE_DB", swsscommon.STATE_INTERFACE_TABLE_NAME), # Peer Managers From 9387350e196f30aed62b03d6ca40e1cfb35b63fe Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Thu, 20 May 2021 21:35:23 +0800 Subject: [PATCH 071/136] Fix the type issue in rvtysh (#7648) Why I did it Change the type issue in the command rvtysh change PARA/para to PARAM/param --- dockers/docker-fpm-frr/base_image_files/rvtysh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dockers/docker-fpm-frr/base_image_files/rvtysh b/dockers/docker-fpm-frr/base_image_files/rvtysh index fb61b949e02b..81fb23046a6d 100755 --- a/dockers/docker-fpm-frr/base_image_files/rvtysh +++ b/dockers/docker-fpm-frr/base_image_files/rvtysh @@ -9,14 +9,14 @@ if printf -- "$*" | grep -qPz '[\n\r|&$;]'; then fi # The sub commands must start with "show" -LAST_PARA= -for para in "$@" +LAST_PARAM= +for param in "$@" do - if [ "$LAST_PARA" == "-c" ] && [[ "$para" != show* ]]; then - echo "Not allow to run the command '$para', please use the comand 'sudo vtysh' instead." 1>&2 + if [ "$LAST_PARAM" == "-c" ] && [[ "$param" != show* ]]; then + echo "Not allow to run the command '$param', please use the comand 'sudo vtysh' instead." 1>&2 exit 1 fi - LAST_PARA=$para + LAST_PARAM=$param done vtysh "$@" From e17e9f4b6079d7e94c84af2841c1a3f499f8747c Mon Sep 17 00:00:00 2001 From: Junchao-Mellanox <57339448+Junchao-Mellanox@users.noreply.github.com> Date: Fri, 21 May 2021 01:12:22 +0800 Subject: [PATCH 072/136] [YANG] Enhance the port yang model with new port fields: adv_speeds, interface_type and adv_interface_types (#6948) Enhance the port yang model with new port fields: adv_speeds, interface_types and adv_interface_types Refer to HLD Azure/SONiC#732 --- .../tests/yang_model_tests/tests/port.json | 38 ++++ .../yang_model_tests/tests_config/port.json | 170 ++++++++++++++++++ .../yang-models/sonic-port.yang | 48 ++++- .../yang-models/sonic-types.yang | 24 +++ 4 files changed, 274 insertions(+), 6 deletions(-) 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 e79507bd8de0..1e217820a276 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 @@ -23,5 +23,43 @@ "desc": "PORT_INVALID_AUTONEG_TEST must condition failure.", "eStrKey" : "Pattern", "eStr": ["on|off"] + }, + "PORT_VALID_ADVSPEEDS_TEST_1": { + "desc": "PORT_VALID_ADVSPEEDS_TEST_1 no failure." + }, + "PORT_VALID_ADVSPEEDS_TEST_2": { + "desc": "PORT_VALID_ADVSPEEDS_TEST_2 no failure." + }, + "PORT_INVALID_ADVSPEEDS_TEST_1": { + "desc": "PORT_INVALID_ADVSPEEDS_TEST_1 InvalidValue condition failure.", + "eStrKey" : "InvalidValue", + "eStr": ["adv_speeds"] + }, + "PORT_INVALID_ADVSPEEDS_TEST_2": { + "desc": "PORT_INVALID_ADVSPEEDS_TEST_2 must condition failure.", + "eStrKey" : "Must" + }, + "PORT_VALID_TYPE_TEST": { + "desc": "PORT_VALID_TYPE_TEST no failure." + }, + "PORT_INVALID_TYPE_TEST": { + "desc": "PORT_INVALID_TYPE_TEST InvalidValue condition failure.", + "eStrKey" : "InvalidValue", + "eStr": ["interface_type"] + }, + "PORT_VALID_ADVTYPES_TEST_1": { + "desc": "PORT_VALID_ADVTYPES_TEST_1 no failure." + }, + "PORT_VALID_ADVTYPES_TEST_2": { + "desc": "PORT_VALID_ADVTYPES_TEST_2 no failure." + }, + "PORT_INVALID_ADVTYPES_TEST_1": { + "desc": "PORT_INVALID_ADVTYPES_TEST_1 InvalidValue condition failure.", + "eStrKey" : "InvalidValue", + "eStr": ["adv_interface_types"] + }, + "PORT_INVALID_ADVTYPES_TEST_2": { + "desc": "PORT_INVALID_ADVTYPES_TEST_2 must condition failure.", + "eStrKey" : "Must" } } 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 661bf252bc61..50d04a007e8d 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 @@ -83,5 +83,175 @@ ] } } + }, + + "PORT_VALID_ADVSPEEDS_TEST_1": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "lanes": "65", + "speed": 25000, + "autoneg": "on", + "adv_speeds": [25000,40000] + } + ] + } + } + }, + + "PORT_VALID_ADVSPEEDS_TEST_2": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "lanes": "65", + "speed": 25000, + "autoneg": "on", + "adv_speeds": ["all"] + } + ] + } + } + }, + + "PORT_INVALID_ADVSPEEDS_TEST_1": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "lanes": "65", + "speed": 25000, + "autoneg": "on", + "adv_speeds": ["invalid"] + } + ] + } + } + }, + + "PORT_INVALID_ADVSPEEDS_TEST_2": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "lanes": "65", + "speed": 25000, + "autoneg": "on", + "adv_speeds": ["all", "25000"] + } + ] + } + } + }, + + "PORT_VALID_TYPE_TEST": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "lanes": "65", + "speed": 25000, + "autoneg": "on", + "interface_type": "CR4" + } + ] + } + } + }, + + "PORT_INVALID_TYPE_TEST": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "lanes": "65", + "speed": 25000, + "autoneg": "on", + "interface_type": "Invalid" + } + ] + } + } + }, + + "PORT_VALID_ADVTYPES_TEST_1": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "lanes": "65", + "speed": 25000, + "autoneg": "on", + "adv_interface_types": ["CR4", "CR"] + } + ] + } + } + }, + + "PORT_VALID_ADVTYPES_TEST_2": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "lanes": "65", + "speed": 25000, + "autoneg": "on", + "adv_interface_types": ["all"] + } + ] + } + } + }, + + "PORT_INVALID_ADVTYPES_TEST_1": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "lanes": "65", + "speed": 25000, + "autoneg": "on", + "adv_interface_types": ["Invalid"] + } + ] + } + } + }, + + "PORT_INVALID_ADVTYPES_TEST_2": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "lanes": "65", + "speed": 25000, + "autoneg": "on", + "adv_interface_types": ["all", "CR4"] + } + ] + } + } } } diff --git a/src/sonic-yang-models/yang-models/sonic-port.yang b/src/sonic-yang-models/yang-models/sonic-port.yang index e585a2caa3c6..ff235ee3ef64 100644 --- a/src/sonic-yang-models/yang-models/sonic-port.yang +++ b/src/sonic-yang-models/yang-models/sonic-port.yang @@ -63,6 +63,48 @@ module sonic-port{ } } + leaf autoneg { + description "Port auto negotiation mode"; + + type string { + pattern "on|off"; + } + } + + leaf-list adv_speeds { + description "Port advertised speeds, valid value could be a list of interger or all"; + + type union { + type uint32 { + range 1..400000; + } + type string { + pattern "all"; + } + } + } + + must "(count(adv_speeds[text()='all']) = 0) or (count(adv_speeds) = 1)"; + + leaf interface_type { + description "Port interface type"; + + type stypes:interface_type; + } + + leaf-list adv_interface_types { + description "Port advertised interface type, valid value could be a list of stypes:interface_type or all"; + + type union { + type stypes:interface_type; + type string { + pattern "all"; + } + } + } + + must "(count(adv_interface_types[text()='all']) = 0) or (count(adv_interface_types) = 1)"; + leaf mtu { type uint16 { range 1..9216; @@ -90,12 +132,6 @@ module sonic-port{ pattern "on|off"; } } - - leaf autoneg { - type string { - pattern "on|off"; - } - } } /* end of list PORT_LIST */ } /* end of container PORT */ diff --git a/src/sonic-yang-models/yang-models/sonic-types.yang b/src/sonic-yang-models/yang-models/sonic-types.yang index 93842a11f51e..2b0fdafafa2c 100644 --- a/src/sonic-yang-models/yang-models/sonic-types.yang +++ b/src/sonic-yang-models/yang-models/sonic-types.yang @@ -114,4 +114,28 @@ module sonic-types { pattern "percentage|used|free|PERCENTAGE|USED|FREE"; } } + + typedef interface_type { + type enumeration { + enum CR; + enum CR2; + enum CR4; + enum SR; + enum SR2; + enum SR4; + enum LR; + enum LR4; + enum KR; + enum KR4; + enum CAUI; + enum GMII; + enum SFI; + enum XLAUI; + enum KR2; + enum CAUI4; + enum XAUI; + enum XFI; + enum XGMII; + } + } } From 3b06f44555fd629bdffb0aff0b535fa238805e27 Mon Sep 17 00:00:00 2001 From: Neetha John Date: Thu, 20 May 2021 10:36:39 -0700 Subject: [PATCH 073/136] [qos]: modify dot1p to tc mapping (#7661) Map priority 0 to TC 1 and priority 1 to TC 0 Send traffic on priority 0 and 1 and verified that it gets mapped correctly in hw Signed-off-by: Neetha John --- files/build_templates/qos_config.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/build_templates/qos_config.j2 b/files/build_templates/qos_config.j2 index a7c361d69fa5..c2b0fe32bcde 100644 --- a/files/build_templates/qos_config.j2 +++ b/files/build_templates/qos_config.j2 @@ -76,8 +76,8 @@ {% 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": { - "0": "0", - "1": "1", + "0": "1", + "1": "0", "2": "2", "3": "3", "4": "4", From 5ab300b62669e65c3095ac50a020f970c0337e66 Mon Sep 17 00:00:00 2001 From: Myron Sosyak <49795530+msosyak@users.noreply.github.com> Date: Fri, 21 May 2021 01:47:46 +0300 Subject: [PATCH 074/136] Fix python version (#7658) #### Why I did it To avoid the following logs ``` Mar 15 15:52:04.599302 igk-dut-04 INFO database#/supervisord: flushdb /bin/bash: /usr/local/bin/flush_unused_database: /usr/bin/python: bad interpreter: No such file or directory Mar 15 15:52:04.599947 igk-dut-04 INFO database#supervisord 2021-03-15 15:52:04,599 INFO exited: flushdb (exit status 126; not expected) ``` #### How I did it Fix shebang #### How to verify it Check the logs --- dockers/docker-database/flush_unused_database | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-database/flush_unused_database b/dockers/docker-database/flush_unused_database index 10cacb5e0b33..e253bc2a4c5d 100755 --- a/dockers/docker-database/flush_unused_database +++ b/dockers/docker-database/flush_unused_database @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 import swsssdk import redis import subprocess From da7533aad43774c4af4acf3ee02c8cdbb8252cae Mon Sep 17 00:00:00 2001 From: Alexander Allen Date: Sun, 23 May 2021 16:40:43 -0400 Subject: [PATCH 075/136] [ntp] Fix ntp.conf template to allow setting of source port in CONFIG_DB (#7586) Why I did it Currently, there is a bug in the ntp.conf jinja2 template where it will ignore the src_intf directive in CONFIG_DB if there are multiple IP addresses associated with an interface. This code change fixes that bug and allows the template to select the correct source interface for NTP. How I did it I did this by modifying the macro in ntp.conf.j2 which determines if there is an ip address associated with an interface to set a state variable when it detects a valid interface entry in CONFIG_DB instead of outputting "true" directly (which could result in multiple "trues" outputted for interfaces with multiple valid IP addresses). How to verify it Add two ipv4 addresses to an interface in SONiC Add the following configuration to config_db.json { "NTP": { "global": { "src_intf": "Ethernet1" } } } Replace Ethernet1 with the interface name of the one you assigned the IP addresses to. Run sudo config reload -y Open /etc/ntp.conf and verify that the following line exists ... interface listen Ethernet1 ... The interface specified should be the one set in the previous steps. Description for the changelog [ntp] Fix ntp.conf template to allow setting of source port in CONFIG_DB --- files/image_config/ntp/ntp.conf.j2 | 4 +- .../tests/data/ntp/ntp_interfaces.json | 12 ++++ src/sonic-config-engine/tests/ntp.conf.j2 | 1 + .../tests/sample_output/py2/ntp.conf | 72 +++++++++++++++++++ .../tests/sample_output/py3/ntp.conf | 72 +++++++++++++++++++ src/sonic-config-engine/tests/test_j2files.py | 9 +++ 6 files changed, 169 insertions(+), 1 deletion(-) create mode 100644 src/sonic-config-engine/tests/data/ntp/ntp_interfaces.json create mode 120000 src/sonic-config-engine/tests/ntp.conf.j2 create mode 100644 src/sonic-config-engine/tests/sample_output/py2/ntp.conf create mode 100644 src/sonic-config-engine/tests/sample_output/py3/ntp.conf diff --git a/files/image_config/ntp/ntp.conf.j2 b/files/image_config/ntp/ntp.conf.j2 index 4b763219325c..280b46a426d8 100644 --- a/files/image_config/ntp/ntp.conf.j2 +++ b/files/image_config/ntp/ntp.conf.j2 @@ -41,13 +41,15 @@ interface ignore wildcard # if the source interface is configured but no ip on that interface, then listen on another # interface based on existing logic {%- macro check_ip_on_interface(interface_name, table_name) %} + {%- set ns = namespace(valid_intf = 'false') %} {%- if table_name %} {%- for (name, source_prefix) in table_name|pfx_filter %} {%- if source_prefix and name == interface_name %} -true + {%- set ns.valid_intf = 'true' %} {%- endif %} {%- endfor %} {%- endif %} +{{ ns.valid_intf }} {%- endmacro %} {% set ns = namespace(source_intf = "") %} diff --git a/src/sonic-config-engine/tests/data/ntp/ntp_interfaces.json b/src/sonic-config-engine/tests/data/ntp/ntp_interfaces.json new file mode 100644 index 000000000000..284758301411 --- /dev/null +++ b/src/sonic-config-engine/tests/data/ntp/ntp_interfaces.json @@ -0,0 +1,12 @@ +{ + "NTP": { + "global": { + "src_intf": "Ethernet0" + } + }, + "INTERFACE": { + "Ethernet0": {}, + "Ethernet0|10.0.0.0/31": {}, + "Ethernet0|192.168.0.122/24": {} + } +} diff --git a/src/sonic-config-engine/tests/ntp.conf.j2 b/src/sonic-config-engine/tests/ntp.conf.j2 new file mode 120000 index 000000000000..bc52df834e26 --- /dev/null +++ b/src/sonic-config-engine/tests/ntp.conf.j2 @@ -0,0 +1 @@ +../../../files/image_config/ntp/ntp.conf.j2 \ No newline at end of file diff --git a/src/sonic-config-engine/tests/sample_output/py2/ntp.conf b/src/sonic-config-engine/tests/sample_output/py2/ntp.conf new file mode 100644 index 000000000000..bc98019e88f7 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py2/ntp.conf @@ -0,0 +1,72 @@ +############################################################################### +# Managed by Ansible +# file: ansible/roles/acs/templates/ntp.conf.j2 +############################################################################### + +# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help + +# To avoid ntpd from panic and exit if the drift between new time and +# current system time is large. +tinker panic 0 + +driftfile /var/lib/ntp/ntp.drift + + +# Enable this if you want statistics to be logged. +#statsdir /var/log/ntpstats/ + +statistics loopstats peerstats clockstats +filegen loopstats file loopstats type day enable +filegen peerstats file peerstats type day enable +filegen clockstats file clockstats type day enable + + +# You do need to talk to an NTP server or two (or three). +#server ntp.your-provider.example + +# pool.ntp.org maps to about 1000 low-stratum NTP servers. Your server will +# pick a different set every time it starts up. Please consider joining the +# pool: + +#listen on source interface if configured, else +#only listen on MGMT_INTERFACE, LOOPBACK_INTERFACE ip when MGMT_INTERFACE is not defined, or eth0 +# if we don't have both of them (default is to listen on all ip addresses) +interface ignore wildcard + +# set global variable for configured source interface name +# set global boolean to indicate if the ip of the configured source interface is configured +# if the source interface is configured but no ip on that interface, then listen on another +# interface based on existing logic + +interface listen Ethernet0 +interface listen 127.0.0.1 + +# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for +# details. The web page +# might also be helpful. +# +# Note that "restrict" applies to both servers and clients, so a configuration +# that might be intended to block requests from certain clients could also end +# up blocking replies from your own upstream servers. + +# By default, exchange time with everybody, but don't allow configuration. +restrict -4 default kod notrap nomodify nopeer noquery +restrict -6 default kod notrap nomodify nopeer noquery + +# Local users may interrogate the ntp server more closely. +restrict 127.0.0.1 +restrict ::1 + +# Clients from this (example!) subnet have unlimited access, but only if +# cryptographically authenticated. +#restrict 192.168.123.0 mask 255.255.255.0 notrust + + +# If you want to provide time to your local subnet, change the next line. +# (Again, the address is an example only.) +#broadcast 192.168.123.255 + +# If you want to listen to time broadcasts on your local subnet, de-comment the +# next lines. Please do this only if you trust everybody on the network! +#disable auth +#broadcastclient diff --git a/src/sonic-config-engine/tests/sample_output/py3/ntp.conf b/src/sonic-config-engine/tests/sample_output/py3/ntp.conf new file mode 100644 index 000000000000..bc98019e88f7 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py3/ntp.conf @@ -0,0 +1,72 @@ +############################################################################### +# Managed by Ansible +# file: ansible/roles/acs/templates/ntp.conf.j2 +############################################################################### + +# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help + +# To avoid ntpd from panic and exit if the drift between new time and +# current system time is large. +tinker panic 0 + +driftfile /var/lib/ntp/ntp.drift + + +# Enable this if you want statistics to be logged. +#statsdir /var/log/ntpstats/ + +statistics loopstats peerstats clockstats +filegen loopstats file loopstats type day enable +filegen peerstats file peerstats type day enable +filegen clockstats file clockstats type day enable + + +# You do need to talk to an NTP server or two (or three). +#server ntp.your-provider.example + +# pool.ntp.org maps to about 1000 low-stratum NTP servers. Your server will +# pick a different set every time it starts up. Please consider joining the +# pool: + +#listen on source interface if configured, else +#only listen on MGMT_INTERFACE, LOOPBACK_INTERFACE ip when MGMT_INTERFACE is not defined, or eth0 +# if we don't have both of them (default is to listen on all ip addresses) +interface ignore wildcard + +# set global variable for configured source interface name +# set global boolean to indicate if the ip of the configured source interface is configured +# if the source interface is configured but no ip on that interface, then listen on another +# interface based on existing logic + +interface listen Ethernet0 +interface listen 127.0.0.1 + +# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for +# details. The web page +# might also be helpful. +# +# Note that "restrict" applies to both servers and clients, so a configuration +# that might be intended to block requests from certain clients could also end +# up blocking replies from your own upstream servers. + +# By default, exchange time with everybody, but don't allow configuration. +restrict -4 default kod notrap nomodify nopeer noquery +restrict -6 default kod notrap nomodify nopeer noquery + +# Local users may interrogate the ntp server more closely. +restrict 127.0.0.1 +restrict ::1 + +# Clients from this (example!) subnet have unlimited access, but only if +# cryptographically authenticated. +#restrict 192.168.123.0 mask 255.255.255.0 notrust + + +# If you want to provide time to your local subnet, change the next line. +# (Again, the address is an example only.) +#broadcast 192.168.123.255 + +# If you want to listen to time broadcasts on your local subnet, de-comment the +# next lines. Please do this only if you trust everybody on the network! +#disable auth +#broadcastclient diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index 8a6fdf5c3934..8b4e9c686bae 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -297,6 +297,15 @@ def test_ndppd_conf(self): self.run_script(argument) assert filecmp.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") + ntp_interfaces_json = os.path.join(self.test_dir, "data", "ntp", "ntp_interfaces.json") + expected = os.path.join(self.test_dir, "sample_output", utils.PYvX_DIR, "ntp.conf") + + 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) + def tearDown(self): try: os.remove(self.output_file) From 1f06b794fb9f087452055afffa9423cd62bf00f8 Mon Sep 17 00:00:00 2001 From: Aravind Mani <53524901+aravindmani-1@users.noreply.github.com> Date: Mon, 24 May 2021 09:20:39 -0700 Subject: [PATCH 076/136] DellEMC: Z9332f fix SFP issues (#7677) #### Why I did it xcvrd crashes when the application advertisement capability flag is not seen for few transceivers. #### How I did it Initialize the additional application capability in dunder init --- .../z9332f/sonic_platform/sfp.py | 22 ++----------------- 1 file changed, 2 insertions(+), 20 deletions(-) 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 318e9485b88f..7089e8698d68 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 @@ -277,6 +277,7 @@ def __init__(self, index, sfp_type, eeprom_path): 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 def get_eeprom_sysfs_path(self): return self.eeprom_path @@ -292,18 +293,6 @@ def detect_dom_capability(self): 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.dom_rx_power_supported = True - self.dom_tx_power_supported = True - self.dom_tx_bias_supported = True - else: - self.qsfp_dd_app2_list = False - self.dom_rx_power_supported = False - self.dom_tx_power_supported = False - self.dom_tx_bias_supported = False - else: - self.dom_rx_power_supported = False - self.dom_tx_power_supported = False - self.dom_tx_bias_supported = False def _strip_unit_from_str(self, value_str): match = re.match(r'(.*)C$|(.*)Volts$|(.*)mA$|(.*)dBm$', value_str) @@ -629,7 +618,7 @@ def get_transceiver_info(self): 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 + host_media_list = host_media_list + host_electrical + ' - ' + media_interface + ' ' transceiver_info_dict['application_advertisement'] = host_media_list return transceiver_info_dict @@ -1079,8 +1068,6 @@ def get_tx_bias(self): if self.sfp_type == 'QSFP_DD': if self.qsfp_dd_DomInfo is None: return None - if not self.dom_tx_bias_supported: - return None 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) @@ -1115,8 +1102,6 @@ def get_rx_power(self): if self.sfp_type == 'QSFP_DD': if self.qsfp_dd_DomInfo is None: return None - if not self.dom_rx_power_supported: - return None offset = 128 rx_power_data_raw = self._read_eeprom_bytes(self.eeprom_path, offset + QSFP_DD_RXPOWER_OFFSET, QSFP_DD_TXPOWER_WIDTH) @@ -1154,9 +1139,6 @@ def get_tx_power(self): if self.qsfp_dd_DomInfo is None: return None - if not self.dom_tx_power_supported: - return None - 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) From f744f9354c714d8ce5ea99527bad9a13e3a94570 Mon Sep 17 00:00:00 2001 From: Neetha John Date: Mon, 24 May 2021 09:33:33 -0700 Subject: [PATCH 077/136] Update MMU and QOS settings for Arista-7050QX-32S-S4Q31 (#7672) Signed-off-by: Neetha John Why I did it Need proper MMU and Qos settings for Arista-7050QX-32S-S4Q31 How I did it Updated the settings based on Arista-7050-QX-32S --- .../buffers_defaults_t0.j2 | 49 ++++++ .../buffers_defaults_t1.j2 | 2 +- .../Arista-7050QX-32S-S4Q31/qos.json.j2 | 149 +----------------- 3 files changed, 51 insertions(+), 149 deletions(-) create mode 100644 device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/buffers_defaults_t0.j2 diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..d93aa34893d6 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/buffers_defaults_t0.j2 @@ -0,0 +1,49 @@ +{%- set default_cable = '300m' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {% if PORT_ALL.append("Ethernet0") %}{% endif %} + {% if PORT_ALL.append("Ethernet1") %}{% endif %} + {% if PORT_ALL.append("Ethernet2") %}{% endif %} + {% if PORT_ALL.append("Ethernet3") %}{% endif %} + {% for port_idx in range(1,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": "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/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/buffers_defaults_t1.j2 b/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/buffers_defaults_t1.j2 index f72e3eb06fb5..d93aa34893d6 100644 --- a/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/buffers_defaults_t1.j2 +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/buffers_defaults_t1.j2 @@ -24,7 +24,7 @@ "mode": "static" }, "egress_lossy_pool": { - "size": "8072396", + "size": "7326924", "type": "egress", "mode": "dynamic" } diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/qos.json.j2 b/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/qos.json.j2 index 1accac3ddd0d..3e548325ea30 100644 --- a/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/qos.json.j2 +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/qos.json.j2 @@ -1,148 +1 @@ -{ - "TC_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "MAP_PFC_PRIORITY_TO_QUEUE": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "TC_TO_QUEUE_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "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" - } - }, - "SCHEDULER": { - "scheduler.0" : { - "type":"DWRR", - "weight": "25" - }, - "scheduler.1" : { - "type":"DWRR", - "weight": "30" - }, - "scheduler.2" : { - "type":"DWRR", - "weight": "20" - } - }, - "PORT_QOS_MAP": { - "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", - "pfc_enable": "3,4" - } - }, - "WRED_PROFILE": { - "AZURE_LOSSLESS" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "wred_red_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"312000", - "red_min_threshold":"104000", - "yellow_max_threshold":"312000", - "yellow_min_threshold":"104000", - "green_max_threshold":"312000", - "green_min_threshold":"104000" - } - }, - "QUEUE": { - "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]" - }, - "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3" : { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" - }, - "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|4" : { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" - }, - "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0" : { - "scheduler" : "[SCHEDULER|scheduler.1]" - }, - "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1" : { - "scheduler" : "[SCHEDULER|scheduler.2]" - } - } -} +{%- include 'qos_config.j2' %} From 6a9d1e584d6d22bbb6600fb6083c1aa9fd0e0248 Mon Sep 17 00:00:00 2001 From: Alexander Allen Date: Mon, 24 May 2021 12:37:59 -0400 Subject: [PATCH 078/136] [Mellanox] Implement Hardware Revision Platform API Call for Mellanox Chassis and PSU (#7552) #### Why I did it This pull request allows calls to be made through the platform 2.0 API that retrieve the PSU and Chassis hardware revision on Mellanox platforms. Access to these values will aid customers in determining their hardware revisions for debugging and technical support. These values are intended to be eventually exposed through the CLI. #### How I did it For the PSU hardware revision I used the existing VPD function calls implemented in https://github.com/Azure/sonic-buildimage/pull/7382 For the Chassis hardware revision I parsed the SMBIOS / DMI type 2 information to retrieve the information. --- .../sonic_platform/chassis.py | 57 +++++++++++++++++++ .../mlnx-platform-api/sonic_platform/psu.py | 17 ++++++ 2 files changed, 74 insertions(+) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py b/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py index b18d780faba9..341a4407feb8 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py @@ -26,6 +26,23 @@ MLNX_NUM_PSU = 2 +DMI_FILE = '/sys/firmware/dmi/entries/2-0/raw' +DMI_HEADER_LEN = 15 +DMI_PRODUCT_NAME = "Product Name" +DMI_MANUFACTURER = "Manufacturer" +DMI_VERSION = "Version" +DMI_SERIAL = "Serial Number" +DMI_ASSET_TAG = "Asset Tag" +DMI_LOC = "Location In Chassis" +DMI_TABLE_MAP = { + DMI_PRODUCT_NAME: 0, + DMI_MANUFACTURER: 1, + DMI_VERSION: 2, + DMI_SERIAL: 3, + DMI_ASSET_TAG: 4, + DMI_LOC: 5 + } + EEPROM_CACHE_ROOT = '/var/cache/sonic/decode-syseeprom' EEPROM_CACHE_FILE = 'syseeprom_cache' @@ -67,6 +84,9 @@ def __init__(self): # 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 # @@ -240,6 +260,18 @@ def get_model(self): string: Model/part number of device """ return self.model + + 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") ############################################## # SFP methods @@ -394,6 +426,31 @@ def _read_generic_file(self, filename, len): return '0' + def _parse_dmi(self, filename): + """ + Read DMI data chassis data and returns a dictionary of values + + Returns: + A dictionary containing the dmi table of the switch chassis info + """ + result = {} + try: + fileobj = open(filename, "rb") + data = fileobj.read() + fileobj.close() + + body = data[DMI_HEADER_LEN:] + records = body.split(b'\x00') + + for k, v in DMI_TABLE_MAP.items(): + result[k] = records[v].decode("utf-8") + + except Exception as e: + logger.log_error("Fail to decode DMI {} due to {}".format(filename, repr(e))) + + return result + + def _verify_reboot_cause(self, filename): ''' Open and read the reboot cause file in diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py b/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py index 12b7a35b7a7b..e357a39141c0 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py @@ -31,6 +31,7 @@ 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 @@ -105,6 +106,12 @@ def __init__(self, psu_index, platform): self.serial = "" 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: + self.rev = "" + 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)) @@ -210,6 +217,16 @@ def get_serial(self): return self.serial + def get_revision(self): + """ + Retrieves the hardware revision of the device + + Returns: + string: Revision value of device + """ + return self.rev + + def get_powergood_status(self): """ Retrieves the operational status of power supply unit (PSU) defined From 3ea3a5c8c137969fc758655087607e655b8f404b Mon Sep 17 00:00:00 2001 From: Junchao-Mellanox <57339448+Junchao-Mellanox@users.noreply.github.com> Date: Tue, 25 May 2021 02:36:39 +0800 Subject: [PATCH 079/136] [Mellanox] clear fan from chassis._fan_list (#7682) #### Why I did it According to thermalctld hld, each fan must belong to a fan drawer, if the fan drawer does not physically exist, put fan into a virtual fan drawer. This PR is to clear fan from chassis._fan_list #### How I did it 1. Don't put fan to chassis._fan_list 2. Always query fan from fan_drawer --- .../sonic_platform/chassis.py | 1 - .../sonic_platform/thermal_infos.py | 41 ++++++++++--------- .../mlnx-platform-api/tests/mock_platform.py | 16 +++++++- .../tests/test_thermal_policy.py | 29 +++++++------ 4 files changed, 52 insertions(+), 35 deletions(-) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py b/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py index 341a4407feb8..1167f56368db 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py @@ -160,7 +160,6 @@ def initialize_fan(self): fan = Fan(fan_index, drawer, index + 1) fan_index += 1 drawer._fan_list.append(fan) - self._fan_list.append(fan) def initialize_single_sfp(self, index): 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 e810a5646456..df262557c417 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/thermal_infos.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/thermal_infos.py @@ -24,26 +24,27 @@ def collect(self, chassis): :return: """ 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._status_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._status_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 + for fan_drawer in chassis.get_all_fan_drawers(): + for fan in fan_drawer.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._status_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._status_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): diff --git a/platform/mellanox/mlnx-platform-api/tests/mock_platform.py b/platform/mellanox/mlnx-platform-api/tests/mock_platform.py index 8edb9d4fb163..1cd8f89d4805 100644 --- a/platform/mellanox/mlnx-platform-api/tests/mock_platform.py +++ b/platform/mellanox/mlnx-platform-api/tests/mock_platform.py @@ -36,10 +36,19 @@ def get_all_fans(self): return [] +class MockFanDrawer: + def __init__(self): + self.fan_list = [] + + def get_all_fans(self): + return self.fan_list + + class MockChassis: def __init__(self): self.fan_list = [] self.psu_list = [] + self.fan_drawer_list = [] def get_all_psus(self): return self.psu_list @@ -47,6 +56,9 @@ def get_all_psus(self): def get_all_fans(self): return self.fan_list + def get_all_fan_drawers(self): + return self.fan_drawer_list + def get_thermal_manager(self): from sonic_platform.thermal_manager import ThermalManager return ThermalManager @@ -54,7 +66,9 @@ def get_thermal_manager(self): def make_fan_absence(self): fan = MockFan() fan.presence = False - self.fan_list.append(fan) + fan_drawer = MockFanDrawer() + self.fan_drawer_list.append(fan_drawer) + fan_drawer.fan_list.append(fan) def make_psu_absence(self): psu = MockPsu() 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 4d69a39c58a1..e2fb26cf6083 100644 --- a/platform/mellanox/mlnx-platform-api/tests/test_thermal_policy.py +++ b/platform/mellanox/mlnx-platform-api/tests/test_thermal_policy.py @@ -3,7 +3,7 @@ import pytest import json from mock import MagicMock -from .mock_platform import MockChassis, MockFan, MockPsu +from .mock_platform import MockChassis, MockFan, MockFanDrawer, MockPsu test_path = os.path.dirname(os.path.abspath(__file__)) modules_path = os.path.dirname(test_path) @@ -49,15 +49,14 @@ def test_fan_info(): assert len(fan_info.get_fault_fans()) == 0 assert fan_info.is_status_changed() - fan_list = chassis.get_all_fans() - fan_list[0].presence = True + chassis.get_all_fan_drawers()[0].get_all_fans()[0].presence = True fan_info.collect(chassis) assert len(fan_info.get_absence_fans()) == 0 assert len(fan_info.get_presence_fans()) == 1 assert len(fan_info.get_fault_fans()) == 0 assert fan_info.is_status_changed() - fan_list[0].status = False + chassis.get_all_fan_drawers()[0].get_all_fans()[0].status = False fan_info.collect(chassis) assert len(fan_info.get_absence_fans()) == 0 assert len(fan_info.get_presence_fans()) == 1 @@ -90,10 +89,10 @@ def test_psu_info(): def test_fan_policy(thermal_manager): chassis = MockChassis() chassis.make_fan_absence() - chassis.fan_list.append(MockFan()) + chassis.get_all_fan_drawers()[0].get_all_fans().append(MockFan()) thermal_manager.run_policy(chassis) - fan_list = chassis.get_all_fans() + 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) @@ -144,7 +143,7 @@ def test_any_fan_absence_condition(): condition = AnyFanAbsenceCondition() assert condition.is_match({'fan_info': fan_info}) - fan = chassis.get_all_fans()[0] + fan = chassis.get_all_fan_drawers()[0].get_all_fans()[0] fan.presence = True fan_info.collect(chassis) assert not condition.is_match({'fan_info': fan_info}) @@ -154,7 +153,7 @@ def test_all_fan_absence_condition(): chassis = MockChassis() chassis.make_fan_absence() fan = MockFan() - fan_list = chassis.get_all_fans() + fan_list = chassis.get_all_fan_drawers()[0].get_all_fans() fan_list.append(fan) fan_info = FanInfo() fan_info.collect(chassis) @@ -172,7 +171,7 @@ def test_all_fan_presence_condition(): chassis = MockChassis() chassis.make_fan_absence() fan = MockFan() - fan_list = chassis.get_all_fans() + fan_list = chassis.get_all_fan_drawers()[0].get_all_fans() fan_list.append(fan) fan_info = FanInfo() fan_info.collect(chassis) @@ -187,8 +186,9 @@ def test_all_fan_presence_condition(): def test_any_fan_fault_condition(): chassis = MockChassis() + chassis.get_all_fan_drawers().append(MockFanDrawer()) fan = MockFan() - fan_list = chassis.get_all_fans() + fan_list = chassis.get_all_fan_drawers()[0].get_all_fans() fan_list.append(fan) fault_fan = MockFan() fault_fan.status = False @@ -206,8 +206,9 @@ def test_any_fan_fault_condition(): def test_all_fan_good_condition(): chassis = MockChassis() + chassis.get_all_fan_drawers().append(MockFanDrawer()) fan = MockFan() - fan_list = chassis.get_all_fans() + fan_list = chassis.get_all_fan_drawers()[0].get_all_fans() fan_list.append(fan) fault_fan = MockFan() fault_fan.status = False @@ -302,7 +303,8 @@ def test_load_set_fan_speed_action(): def test_execute_set_fan_speed_action(): chassis = MockChassis() - fan_list = chassis.get_all_fans() + 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() @@ -364,7 +366,8 @@ def test_load_check_and_set_speed_action(): def test_execute_check_and_set_fan_speed_action(): chassis = MockChassis() - fan_list = chassis.get_all_fans() + 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() From 0ccd38e4d95608d738b1c84ac9fcd63ee10a94d2 Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Tue, 25 May 2021 07:22:04 +0800 Subject: [PATCH 080/136] [Submodule update] sonic-snmpagent (#7638) #### Why I did it Update sonic-snmpaget submodule to pick up new commits: > Extend rfc3433.py to support more Physical Entity Sensor MIB entries https://github.com/Azure/sonic-snmpagent/commit/28b9dfd3a294904150b2d33bd3ff35a1a637d28d #### How I did it update the submodule pointer to including the new commits #### How to verify it run community snmp test. --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index 4e063e4ade89..28b9dfd3a294 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit 4e063e4ade89943f2413a767f24564aecfa2cd1c +Subproject commit 28b9dfd3a294904150b2d33bd3ff35a1a637d28d From 6f884b7278d6fc4349508eced7b91cd454765961 Mon Sep 17 00:00:00 2001 From: Neetha John Date: Mon, 24 May 2021 17:15:37 -0700 Subject: [PATCH 081/136] Update PG profile settings for Arista-7050QX-32S-S4Q31 (#7673) Signed-off-by: Neetha John Why I did it PG profile settings need to be aligned with Arista-7050-QX-32S How I did it Copy over the current settings from Arista-7050-QX-32S and define params for 10G and 1G speeds as well --- .../pg_profile_lookup.ini | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/pg_profile_lookup.ini b/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/pg_profile_lookup.ini index f961fd33b138..389a7da97287 100644 --- a/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/pg_profile_lookup.ini +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/pg_profile_lookup.ini @@ -1,14 +1,17 @@ # PG lossless profiles. # speed cable size xon xoff threshold xon_offset - 10000 5m 41808 18432 40560 -4 2496 - 40000 5m 41808 18432 40560 -4 2496 - 50000 5m 41808 18432 40560 -4 2496 - 100000 5m 41808 18432 40560 -4 2496 - 10000 40m 41808 18432 40560 -4 2496 - 40000 40m 41808 18432 40560 -4 2496 - 50000 40m 41808 18432 40560 -4 2496 - 100000 40m 41808 18432 40560 -4 2496 - 10000 300m 41808 18432 40560 -4 2496 - 40000 300m 41808 18432 40560 -4 2496 - 50000 300m 41808 18432 40560 -4 2496 - 100000 300m 41808 18432 40560 -4 2496 + 1000 5m 41808 18432 40560 -3 2496 + 10000 5m 41808 18432 40560 -3 2496 + 40000 5m 46384 18432 45136 -3 2496 + 50000 5m 46592 18432 45344 -3 2496 + 100000 5m 48464 18432 47216 -3 2496 + 1000 40m 41808 18432 40560 -3 2496 + 10000 40m 41808 18432 40560 -3 2496 + 40000 40m 48464 18432 47216 -3 2496 + 50000 40m 49296 18432 48048 -3 2496 + 100000 40m 53872 18432 52624 -3 2496 + 1000 300m 41808 18432 40560 -3 2496 + 10000 300m 41808 18432 40560 -3 2496 + 40000 300m 64064 18432 62816 -3 2496 + 50000 300m 68848 18432 67600 -3 2496 + 100000 300m 92976 18432 91728 -3 2496 From 9930e738feadbcad274eec7d934df7f00d88856a Mon Sep 17 00:00:00 2001 From: shlomibitton <60430976+shlomibitton@users.noreply.github.com> Date: Tue, 25 May 2021 03:23:49 +0300 Subject: [PATCH 082/136] Remove 'vm.panic_on_oom=1' (#7678) #### Why I did it If a process limits using nodes by mempolicy/cpusets, and those nodes become memory exhaustion status, one process may be killed by oom-killer. No panic occurs in this case, because other node's memory may be free. This means system total status may be not fatal yet. #### How I did it Remove 'vm.panic_on_oom=1' kernel flag from 'vmcore-sysctl.conf ' --- files/image_config/kdump/vmcore-sysctl.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/files/image_config/kdump/vmcore-sysctl.conf b/files/image_config/kdump/vmcore-sysctl.conf index 9a4016197cbd..1eb8646683a2 100755 --- a/files/image_config/kdump/vmcore-sysctl.conf +++ b/files/image_config/kdump/vmcore-sysctl.conf @@ -4,4 +4,3 @@ kernel.panic_on_io_nmi=1 kernel.panic_on_stackoverflow=1 kernel.hung_task_panic=1 kernel.unknown_nmi_panic=1 -vm.panic_on_oom=1 From cf83a99f450677ff1dcd47135a817919d9ad7b03 Mon Sep 17 00:00:00 2001 From: LuiSzee Date: Tue, 25 May 2021 23:17:44 +0800 Subject: [PATCH 083/136] [radv] fix bug for radv can't startup if DEVICE_METADATA.localhost.type is NULL (#7651) Co-authored-by: Shi Lei --- ...ocker-router-advertiser.supervisord.conf.j2 | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) 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 6df8e4527af4..3be84f54fda5 100644 --- a/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf.j2 +++ b/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf.j2 @@ -44,14 +44,16 @@ dependent_startup_wait_for=rsyslogd:running {# But not for specific deployment_id #} {%- set vlan_v6 = namespace(count=0) -%} {%- if DEVICE_METADATA.localhost.deployment_id != "8" -%} - {%- if "ToRRouter" in DEVICE_METADATA.localhost.type and DEVICE_METADATA.localhost.type != "MgmtToRRouter" -%} - {%- if VLAN_INTERFACE -%} - {%- for (name, prefix) in VLAN_INTERFACE|pfx_filter -%} - {# If this VLAN has an IPv6 address... #} - {%- if prefix | ipv6 -%} - {%- set vlan_v6.count = vlan_v6.count + 1 -%} - {%- endif -%} - {%- endfor -%} + {%- if DEVICE_METADATA.localhost.type -%} + {%- if "ToRRouter" in DEVICE_METADATA.localhost.type and DEVICE_METADATA.localhost.type != "MgmtToRRouter" -%} + {%- if VLAN_INTERFACE -%} + {%- for (name, prefix) in VLAN_INTERFACE|pfx_filter -%} + {# If this VLAN has an IPv6 address... #} + {%- if prefix | ipv6 -%} + {%- set vlan_v6.count = vlan_v6.count + 1 -%} + {%- endif -%} + {%- endfor -%} + {%- endif -%} {%- endif -%} {%- endif -%} {%- endif -%} From 7c811c56b33aa6119189fcef44ebf6a9c9bc53bb Mon Sep 17 00:00:00 2001 From: Sudharsan Dhamal Gopalarathnam Date: Tue, 25 May 2021 09:07:32 -0700 Subject: [PATCH 084/136] FEC none config through minigraph (#7667) When FECDisabled is set to true in minigraph.py, push 'fec' 'none' explicitly to config_db. When 'fec' is defined in port_config.ini do not override it with 'rs' for 100G --- src/sonic-config-engine/minigraph.py | 6 ++++-- src/sonic-config-engine/tests/test_cfggen.py | 10 +++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 3bbf4095a32f..66974d45e41b 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -1410,9 +1410,11 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw for port_name, port in list(ports.items()): # get port alias from port_config.ini alias = port.get('alias', port_name) - # generate default 100G FEC + # generate default 100G FEC only if FECDisabled is not true and 'fec' is not defined in port_config.ini # Note: FECDisabled only be effective on 100G port right now - if port.get('speed') == '100000' and linkmetas.get(alias, {}).get('FECDisabled', '').lower() != 'true': + if linkmetas.get(alias, {}).get('FECDisabled', '').lower() == 'true': + port['fec'] = 'none' + elif not port.get('fec') and port.get('speed') == '100000': port['fec'] = 'rs' # If AutoNegotiation is available in the minigraph, we override any value we may have received from port_config.ini diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 69da794ca5a0..4d0595270071 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -342,7 +342,7 @@ def test_minigraph_port_fec_disabled(self): output = self.run_script(argument) self.assertEqual( utils.to_dict(output.strip()), - utils.to_dict("{'lanes': '25,26,27,28', 'description': 'Servers0:eth0', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/4', 'admin_status': 'up', 'speed': '100000', 'autoneg': 'on'}") + utils.to_dict("{'lanes': '25,26,27,28', 'description': 'Servers0:eth0', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/4', 'admin_status': 'up', 'speed': '100000', 'autoneg': 'on', 'fec': 'none'}") ) def test_minigraph_port_autonegotiation(self): @@ -353,8 +353,8 @@ def test_minigraph_port_autonegotiation(self): 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'}, " - "'Ethernet4': {'lanes': '25,26,27,28', 'description': 'Servers0:eth0', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/4', 'admin_status': 'up', 'autoneg': 'on', 'speed': '100000'}, " - "'Ethernet8': {'lanes': '37,38,39,40', 'description': 'fortyGigE0/8', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'autoneg': 'off'}, " + "'Ethernet4': {'lanes': '25,26,27,28', 'description': 'Servers0:eth0', 'pfc_asym': 'off', 'mtu': '9100', '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', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'autoneg': 'off', 'fec': 'none'}, " "'Ethernet12': {'lanes': '33,34,35,36', 'description': 'fortyGigE0/12', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/12', 'admin_status': 'up'}, " "'Ethernet16': {'lanes': '41,42,43,44', 'description': 'fortyGigE0/16', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/16', 'admin_status': 'up'}, " "'Ethernet20': {'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/20', 'admin_status': 'up'}, " @@ -394,8 +394,8 @@ def test_minigraph_port_autonegotiation(self): utils.to_dict(output.strip()), utils.to_dict( "{'Ethernet0': {'lanes': '29,30,31,32', 'description': 'fortyGigE0/0', 'mtu': '9100', 'alias': 'fortyGigE0/0', 'pfc_asym': 'off', 'autoneg': 'off'}, " - "'Ethernet4': {'lanes': '25,26,27,28', 'description': 'Servers0:eth0', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/4', 'admin_status': 'up', 'autoneg': 'on', 'speed': '100000'}, " - "'Ethernet8': {'lanes': '37,38,39,40', 'description': 'fortyGigE0/8', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'autoneg': 'off'}, " + "'Ethernet4': {'lanes': '25,26,27,28', 'description': 'Servers0:eth0', 'pfc_asym': 'off', 'mtu': '9100', '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', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'autoneg': 'off', 'fec': 'none'}, " "'Ethernet12': {'lanes': '33,34,35,36', 'description': 'fortyGigE0/12', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/12', 'admin_status': 'up', 'autoneg': 'off'}, " "'Ethernet16': {'lanes': '41,42,43,44', 'description': 'fortyGigE0/16', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/16', 'admin_status': 'up', 'autoneg': 'off'}, " "'Ethernet20': {'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/20', 'admin_status': 'up', 'autoneg': 'off'}, " From 953f91343adb7f43e773a6db5ef776234190b961 Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Wed, 26 May 2021 01:41:53 +0800 Subject: [PATCH 085/136] [Mellanox] Update the Spectrum-2 platform PSU sensor's label in the sensor conf file (#7706) #### Why I did it The label for PSU related sensors on the Spectrum-2 platform is not aligned with the physical location of the PSU. #### How I did it Update the label in the sensor conf file for those relevant platforms Signed-off-by: Kebo Liu --- .../x86_64-mlnx_msn3420-r0/sensors.conf | 22 +++++++-------- .../x86_64-mlnx_msn3700-r0/sensors.conf | 28 +++++++++---------- .../x86_64-mlnx_msn3700c-r0/sensors.conf | 28 +++++++++---------- .../x86_64-mlnx_msn3800-r0/sensors.conf | 28 +++++++++---------- 4 files changed, 53 insertions(+), 53 deletions(-) diff --git a/device/mellanox/x86_64-mlnx_msn3420-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn3420-r0/sensors.conf index f31cbe7adbc7..b0e4901eccca 100644 --- a/device/mellanox/x86_64-mlnx_msn3420-r0/sensors.conf +++ b/device/mellanox/x86_64-mlnx_msn3420-r0/sensors.conf @@ -79,17 +79,6 @@ bus "i2c-15" "i2c-1-mux (chan_id 6)" # Power supplies bus "i2c-4" "i2c-1-mux (chan_id 3)" chip "dps460-i2c-*-58" - label in1 "PSU-1 220V Rail (in)" - label in2 "PSU-1 12V Rail (out)" - label fan1 "PSU-1 Fan 1" - label temp1 "PSU-1 Temp 1" - label temp2 "PSU-1 Temp 2" - label temp3 "PSU-1 Temp 3" - label power1 "PSU-1 220V Rail Pwr (in)" - label power2 "PSU-1 12V Rail Pwr (out)" - label curr1 "PSU-1 220V Rail Curr (in)" - label curr2 "PSU-1 12V Rail Curr (out)" - chip "dps460-i2c-*-59" label in1 "PSU-2 220V Rail (in)" label in2 "PSU-2 12V Rail (out)" label fan1 "PSU-2 Fan 1" @@ -100,6 +89,17 @@ bus "i2c-4" "i2c-1-mux (chan_id 3)" label power2 "PSU-2 12V Rail Pwr (out)" label curr1 "PSU-2 220V Rail Curr (in)" label curr2 "PSU-2 12V Rail Curr (out)" + chip "dps460-i2c-*-59" + label in1 "PSU-1 220V Rail (in)" + label in2 "PSU-1 12V Rail (out)" + label fan1 "PSU-1 Fan 1" + label temp1 "PSU-1 Temp 1" + label temp2 "PSU-1 Temp 2" + label temp3 "PSU-1 Temp 3" + label power1 "PSU-1 220V Rail Pwr (in)" + label power2 "PSU-1 12V Rail Pwr (out)" + label curr1 "PSU-1 220V Rail Curr (in)" + label curr2 "PSU-1 12V Rail Curr (out)" # Chassis fans chip "mlxreg_fan-isa-*" diff --git a/device/mellanox/x86_64-mlnx_msn3700-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn3700-r0/sensors.conf index 28a889aa27d2..281f0a54dfa3 100644 --- a/device/mellanox/x86_64-mlnx_msn3700-r0/sensors.conf +++ b/device/mellanox/x86_64-mlnx_msn3700-r0/sensors.conf @@ -72,20 +72,6 @@ bus "i2c-15" "i2c-1-mux (chan_id 6)" # Power supplies bus "i2c-4" "i2c-1-mux (chan_id 3)" chip "dps460-i2c-*-58" - label in1 "PSU-1 220V Rail (in)" - ignore in2 - label in3 "PSU-1 12V Rail (out)" - label fan1 "PSU-1 Fan 1" - ignore fan2 - ignore fan3 - label temp1 "PSU-1 Temp 1" - label temp2 "PSU-1 Temp 2" - label temp3 "PSU-1 Temp 3" - label power1 "PSU-1 220V Rail Pwr (in)" - label power2 "PSU-1 12V Rail Pwr (out)" - label curr1 "PSU-1 220V Rail Curr (in)" - label curr2 "PSU-1 12V Rail Curr (out)" - chip "dps460-i2c-*-59" label in1 "PSU-2 220V Rail (in)" ignore in2 label in3 "PSU-2 12V Rail (out)" @@ -99,6 +85,20 @@ bus "i2c-4" "i2c-1-mux (chan_id 3)" label power2 "PSU-2 12V Rail Pwr (out)" label curr1 "PSU-2 220V Rail Curr (in)" label curr2 "PSU-2 12V Rail Curr (out)" + chip "dps460-i2c-*-59" + label in1 "PSU-1 220V Rail (in)" + ignore in2 + label in3 "PSU-1 12V Rail (out)" + label fan1 "PSU-1 Fan 1" + ignore fan2 + ignore fan3 + label temp1 "PSU-1 Temp 1" + label temp2 "PSU-1 Temp 2" + label temp3 "PSU-1 Temp 3" + label power1 "PSU-1 220V Rail Pwr (in)" + label power2 "PSU-1 12V Rail Pwr (out)" + label curr1 "PSU-1 220V Rail Curr (in)" + label curr2 "PSU-1 12V Rail Curr (out)" # Chassis fans chip "mlxreg_fan-isa-*" diff --git a/device/mellanox/x86_64-mlnx_msn3700c-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn3700c-r0/sensors.conf index 3c58e27f3e68..094cd78cde57 100644 --- a/device/mellanox/x86_64-mlnx_msn3700c-r0/sensors.conf +++ b/device/mellanox/x86_64-mlnx_msn3700c-r0/sensors.conf @@ -72,20 +72,6 @@ bus "i2c-15" "i2c-1-mux (chan_id 6)" # Power supplies bus "i2c-4" "i2c-1-mux (chan_id 3)" chip "dps460-i2c-*-58" - label in1 "PSU-1 220V Rail (in)" - ignore in2 - label in3 "PSU-1 12V Rail (out)" - label fan1 "PSU-1 Fan 1" - ignore fan2 - ignore fan3 - label temp1 "PSU-1 Temp 1" - label temp2 "PSU-1 Temp 2" - label temp3 "PSU-1 Temp 3" - label power1 "PSU-1 220V Rail Pwr (in)" - label power2 "PSU-1 12V Rail Pwr (out)" - label curr1 "PSU-1 220V Rail Curr (in)" - label curr2 "PSU-1 12V Rail Curr (out)" - chip "dps460-i2c-*-59" label in1 "PSU-2 220V Rail (in)" ignore in2 label in3 "PSU-2 12V Rail (out)" @@ -99,6 +85,20 @@ bus "i2c-4" "i2c-1-mux (chan_id 3)" label power2 "PSU-2 12V Rail Pwr (out)" label curr1 "PSU-2 220V Rail Curr (in)" label curr2 "PSU-2 12V Rail Curr (out)" + chip "dps460-i2c-*-59" + label in1 "PSU-1 220V Rail (in)" + ignore in2 + label in3 "PSU-1 12V Rail (out)" + label fan1 "PSU-1 Fan 1" + ignore fan2 + ignore fan3 + label temp1 "PSU-1 Temp 1" + label temp2 "PSU-1 Temp 2" + label temp3 "PSU-1 Temp 3" + label power1 "PSU-1 220V Rail Pwr (in)" + label power2 "PSU-1 12V Rail Pwr (out)" + label curr1 "PSU-1 220V Rail Curr (in)" + label curr2 "PSU-1 12V Rail Curr (out)" # Chassis fans chip "mlxreg_fan-isa-*" diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn3800-r0/sensors.conf index 9777c5e84398..7ba5f9c8c050 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/sensors.conf +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/sensors.conf @@ -93,20 +93,6 @@ bus "i2c-15" "i2c-1-mux (chan_id 6)" # Power supplies bus "i2c-4" "i2c-1-mux (chan_id 3)" chip "dps460-i2c-*-58" - label in1 "PSU-1 220V Rail (in)" - ignore in2 - label in3 "PSU-1 12V Rail (out)" - label fan1 "PSU-1 Fan 1" - ignore fan2 - ignore fan3 - label temp1 "PSU-1 Temp 1" - label temp2 "PSU-1 Temp 2" - label temp3 "PSU-1 Temp 3" - label power1 "PSU-1 220V Rail Pwr (in)" - label power2 "PSU-1 12V Rail Pwr (out)" - label curr1 "PSU-1 220V Rail Curr (in)" - label curr2 "PSU-1 12V Rail Curr (out)" - chip "dps460-i2c-*-59" label in1 "PSU-2 220V Rail (in)" ignore in2 label in3 "PSU-2 12V Rail (out)" @@ -120,6 +106,20 @@ bus "i2c-4" "i2c-1-mux (chan_id 3)" label power2 "PSU-2 12V Rail Pwr (out)" label curr1 "PSU-2 220V Rail Curr (in)" label curr2 "PSU-2 12V Rail Curr (out)" + chip "dps460-i2c-*-59" + label in1 "PSU-1 220V Rail (in)" + ignore in2 + label in3 "PSU-1 12V Rail (out)" + label fan1 "PSU-1 Fan 1" + ignore fan2 + ignore fan3 + label temp1 "PSU-1 Temp 1" + label temp2 "PSU-1 Temp 2" + label temp3 "PSU-1 Temp 3" + label power1 "PSU-1 220V Rail Pwr (in)" + label power2 "PSU-1 12V Rail Pwr (out)" + label curr1 "PSU-1 220V Rail Curr (in)" + label curr2 "PSU-1 12V Rail Curr (out)" # Chassis fans chip "mlxreg_fan-isa-*" From 44487710885d11c4b9fe5bf0dfd0e93fbcbe5744 Mon Sep 17 00:00:00 2001 From: Volodymyr Boiko <66446128+vboykox@users.noreply.github.com> Date: Tue, 25 May 2021 23:48:17 +0300 Subject: [PATCH 086/136] [barefoot][device] Support pcied on Mavericks (#7705) Add pcie.yaml to enable pcied on Mavericks platform Signed-off-by: Volodymyr Boyko --- .../x86_64-accton_wedge100bf_65x-r0/pcie.yaml | 412 ++++++++++++++++++ .../pmon_daemon_control.json | 2 +- 2 files changed, 413 insertions(+), 1 deletion(-) create mode 100644 device/barefoot/x86_64-accton_wedge100bf_65x-r0/pcie.yaml diff --git a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/pcie.yaml b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/pcie.yaml new file mode 100644 index 000000000000..52035fa8df81 --- /dev/null +++ b/device/barefoot/x86_64-accton_wedge100bf_65x-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: '16' + fn: '0' + id: 8c3a + name: 'Communication controller: Intel Corporation 8 Series/C220 Series Chipset + Family MEI Controller #1 (rev 04)' +- bus: '00' + dev: '16' + fn: '1' + id: 8c3b + name: 'Communication controller: Intel Corporation 8 Series/C220 Series Chipset + Family MEI Controller #2 (rev 04)' +- 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: '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/barefoot/x86_64-accton_wedge100bf_65x-r0/pmon_daemon_control.json b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/pmon_daemon_control.json index d23e302dab34..b58e59ba000c 100644 --- a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/pmon_daemon_control.json +++ b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/pmon_daemon_control.json @@ -1,5 +1,5 @@ { - "skip_pcied": true, + "skip_pcied": false, "skip_fancontrol": true, "skip_thermalctld": false, "skip_ledd": true, From e3041821168d324401a3ba8d8e05868c50061d40 Mon Sep 17 00:00:00 2001 From: bingwang-ms <66248323+bingwang-ms@users.noreply.github.com> Date: Wed, 26 May 2021 18:28:10 +0800 Subject: [PATCH 087/136] Fix supervisor-proc-exit-listener startup issue in restapi (#7681) * Fix supervisor-proc-exit-listener startup issue in restapi Signed-off-by: bingwang --- dockers/docker-sonic-restapi/supervisord.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-sonic-restapi/supervisord.conf b/dockers/docker-sonic-restapi/supervisord.conf index 683f10ab4da8..4286a6dd3ec3 100644 --- a/dockers/docker-sonic-restapi/supervisord.conf +++ b/dockers/docker-sonic-restapi/supervisord.conf @@ -13,7 +13,7 @@ events=PROCESS_STATE buffer_size=1024 [eventlistener:supervisor-proc-exit-listener] -command=/usr/bin/supervisor-proc-exit-listener --container-name restapi +command=python2 /usr/bin/supervisor-proc-exit-listener --container-name restapi events=PROCESS_STATE_EXITED,PROCESS_STATE_RUNNING autostart=true autorestart=false From 556a1dc9a856758743741eff95f4a0d9fe3c23b6 Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Wed, 26 May 2021 09:12:34 -0700 Subject: [PATCH 088/136] [Mux] Do not clean-up HW_MUX_CABLE_TABLE from State DB (#7710) Co-authored-by: Ubuntu --- files/scripts/swss.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh index 97e50cb975e7..25e948e5e6da 100755 --- a/files/scripts/swss.sh +++ b/files/scripts/swss.sh @@ -146,7 +146,7 @@ start() { $SONIC_DB_CLI ASIC_DB FLUSHDB $SONIC_DB_CLI COUNTERS_DB FLUSHDB $SONIC_DB_CLI FLEX_COUNTER_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*'" + 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*'" fi # start service docker From 79914f5336ef4a58c9027d17a41ea68df4089361 Mon Sep 17 00:00:00 2001 From: Lawrence Lee Date: Wed, 26 May 2021 09:12:54 -0700 Subject: [PATCH 089/136] [swss.service]: Remove ordering with pmon (#7614) Signed-off-by: Lawrence Lee --- files/build_templates/per_namespace/swss.service.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/build_templates/per_namespace/swss.service.j2 b/files/build_templates/per_namespace/swss.service.j2 index 5fb86929d3ba..9dd7b42c4d9d 100644 --- a/files/build_templates/per_namespace/swss.service.j2 +++ b/files/build_templates/per_namespace/swss.service.j2 @@ -14,7 +14,7 @@ After=updategraph.service After=interfaces-config.service BindsTo=sonic.target After=sonic.target -Before=ntp-config.service pmon.service +Before=ntp-config.service StartLimitIntervalSec=1200 StartLimitBurst=3 From 1b33ebc9cdaf61fe874e264bbab1f005eb6c9378 Mon Sep 17 00:00:00 2001 From: Renuka Manavalan <47282725+renukamanavalan@users.noreply.github.com> Date: Wed, 26 May 2021 09:17:48 -0700 Subject: [PATCH 090/136] K8S handles hostname in lower case (#7694) Why I did it k8s handles in lower case, so the code ensures that it uses hostname in all lower case How I did it Wrapper for device_info.get_hostname that returns in lower case. This wrapper is used in all places that require hostname to use in kubectl commands. How to verify it Device joins successfully. --- src/sonic-ctrmgrd/ctrmgr/kube_commands.py | 18 +++++----- src/sonic-ctrmgrd/tests/kube_commands_test.py | 36 +++++++++---------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/sonic-ctrmgrd/ctrmgr/kube_commands.py b/src/sonic-ctrmgrd/ctrmgr/kube_commands.py index 5eaad0a82bb2..9a6ea9ed8dff 100755 --- a/src/sonic-ctrmgrd/ctrmgr/kube_commands.py +++ b/src/sonic-ctrmgrd/ctrmgr/kube_commands.py @@ -25,9 +25,6 @@ FLANNEL_CONF_FILE = "/usr/share/sonic/templates/kube_cni.10-flannel.conflist" CNI_DIR = "/etc/cni/net.d" -# kubectl --kubeconfig label nodes -#