diff --git a/.gitmodules b/.gitmodules index 915b19cb1372..04e989f3e675 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,15 +1,18 @@ [submodule "sonic-swss-common"] path = src/sonic-swss-common url = https://github.com/Azure/sonic-swss-common + branch = 201811 [submodule "sonic-linux-kernel"] path = src/sonic-linux-kernel url = https://github.com/Azure/sonic-linux-kernel [submodule "sonic-sairedis"] path = src/sonic-sairedis url = https://github.com/Azure/sonic-sairedis + branch = 201811 [submodule "sonic-swss"] path = src/sonic-swss url = https://github.com/Azure/sonic-swss + branch = 201811 [submodule "src/p4c-bm/p4c-bm"] path = platform/p4/p4c-bm/p4c-bm url = https://github.com/krambn/p4c-bm @@ -35,12 +38,14 @@ [submodule "src/sonic-utilities"] path = src/sonic-utilities url = https://github.com/Azure/sonic-utilities + branch = 201811 [submodule "platform/broadcom/sonic-platform-modules-arista"] path = platform/broadcom/sonic-platform-modules-arista url = https://github.com/aristanetworks/sonic [submodule "src/sonic-platform-common"] path = src/sonic-platform-common url = https://github.com/Azure/sonic-platform-common + branch = 201811 [submodule "src/sonic-platform-daemons"] path = src/sonic-platform-daemons url = https://github.com/Azure/sonic-platform-daemons @@ -62,3 +67,6 @@ [submodule "src/redis-dump-load"] path = src/redis-dump-load url = https://github.com/p/redis-dump-load.git +[submodule "platform/broadcom/sonic-platform-modules-cel"] + path = platform/broadcom/sonic-platform-modules-cel + url = https://github.com/celestica-Inc/sonic-platform-modules-cel.git diff --git a/Makefile.work b/Makefile.work index 6c4828134a8a..eb71a774cab2 100644 --- a/Makefile.work +++ b/Makefile.work @@ -27,6 +27,9 @@ # * make NOSTRETCH=1 KEEP_SLAVE_ON=yes # * SOURCE_FOLDER: host path to be mount as /var/$(USER)/src, only effective when KEEP_SLAVE_ON=yes # * SONIC_BUILD_JOBS: Specifying number of concurrent build job(s) to run +# * VS_PREPARE_MEM: Prepare memory in VS build (drop cache and compact). +# * Default: yes +# * Values: yes, no # * KERNEL_PROCURE_METHOD: Specifying method of obtaining kernel Debian package: download or build # ############################################################################### @@ -114,6 +117,7 @@ SONIC_BUILD_INSTRUCTION := make \ PASSWORD=$(PASSWORD) \ USERNAME=$(USERNAME) \ SONIC_BUILD_JOBS=$(SONIC_BUILD_JOBS) \ + VS_PREPARE_MEM=$(VS_PREPARE_MEM) \ KERNEL_PROCURE_METHOD=$(KERNEL_PROCURE_METHOD) \ HTTP_PROXY=$(http_proxy) \ HTTPS_PROXY=$(https_proxy) \ diff --git a/build_debian.sh b/build_debian.sh index 1010fbc26e0f..128da78aa5f4 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -29,7 +29,7 @@ set -x -e ## docker engine version (with platform) -DOCKER_VERSION=5:18.09.0~3-0~debian-stretch +DOCKER_VERSION=5:18.09.2~3-0~debian-stretch LINUX_KERNEL_VERSION=4.9.0-8 ## Working directory to prepare the file system @@ -150,8 +150,8 @@ sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/union-mou sudo cp files/initramfs-tools/varlog $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/varlog sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/varlog # Management interface (eth0) dhcp can be optionally turned off (during a migration from another NOS to SONiC) -sudo cp files/initramfs-tools/mgmt-intf-dhcp $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/mgmt-intf-dhcp -sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/mgmt-intf-dhcp +#sudo cp files/initramfs-tools/mgmt-intf-dhcp $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/mgmt-intf-dhcp +#sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/mgmt-intf-dhcp sudo cp files/initramfs-tools/union-fsck $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/union-fsck sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/union-fsck pushd $FILESYSTEM_ROOT/usr/share/initramfs-tools/scripts/init-bottom && sudo patch -p1 < $OLDPWD/files/initramfs-tools/udev.patch; popd @@ -182,6 +182,8 @@ sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y remove software-properties-common sudo mkdir -p $FILESYSTEM_ROOT/etc/systemd/system/docker.service.d/ ## Note: $_ means last argument of last command sudo cp files/docker/docker.service.conf $_ +## Fix systemd race between docker and containerd +sudo sed -i '/After=/s/$/ containerd.service/' $FILESYSTEM_ROOT/lib/systemd/system/docker.service ## Create default user ## Note: user should be in the group with the same name, and also in sudo/docker group @@ -240,7 +242,8 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in python-scapy \ tcptraceroute \ mtr-tiny \ - locales + locales \ + dmidecode #Adds a locale to a debian system in non-interactive mode sudo sed -i '/^#.* en_US.* /s/^#//' $FILESYSTEM_ROOT/etc/locale.gen && \ @@ -261,6 +264,10 @@ sudo mv $FILESYSTEM_ROOT/grub-pc-bin*.deb $FILESYSTEM_ROOT/$PLATFORM_DIR/x86_64- ## Disable kexec supported reboot which was installed by default sudo sed -i 's/LOAD_KEXEC=true/LOAD_KEXEC=false/' $FILESYSTEM_ROOT/etc/default/kexec +## Modifty ntp default configuration: disable initial jump (add -x), and disable +## jump when time difference is greater than 1000 seconds (remove -g). +sudo sed -i "s/NTPD_OPTS='-g'/NTPD_OPTS='-x'/" $FILESYSTEM_ROOT/etc/default/ntp + ## Fix ping tools permission so non root user can directly use them ## Note: this is a workaround since aufs doesn't support extended attributes ## Ref: https://github.com/moby/moby/issues/5650#issuecomment-303499489 @@ -339,6 +346,7 @@ set /files/etc/sysctl.conf/net.ipv6.conf.all.keep_addr_on_down 1 set /files/etc/sysctl.conf/net.ipv6.conf.eth0.keep_addr_on_down 1 set /files/etc/sysctl.conf/net.ipv6.conf.eth0.accept_ra_defrtr 0 +set /files/etc/sysctl.conf/net.ipv6.conf.eth0.accept_ra 0 set /files/etc/sysctl.conf/net.core.rmem_max 2097152 set /files/etc/sysctl.conf/net.core.wmem_max 2097152 diff --git a/build_kvm_image.sh b/build_kvm_image.sh index b08db96f573c..bc0f54e12d5c 100755 --- a/build_kvm_image.sh +++ b/build_kvm_image.sh @@ -1,4 +1,4 @@ -#!/bin/sh -ex +#!/bin/bash -ex # Copyright (C) 2014 Curt Brune # @@ -47,6 +47,15 @@ prepare_installer_disk() create_disk prepare_installer_disk +echo "Prepare memory for KVM build: $vs_build_prepare_mem" +free -m +if [[ "$vs_build_prepare_mem" == "yes" ]]; then + # Force o.s. to drop cache and compact memory so that KVM can get 2G memory + sudo bash -c 'echo 1 > /proc/sys/vm/drop_caches' + sudo bash -c 'echo 1 > /proc/sys/vm/compact_memory' + free -m +fi + /usr/bin/kvm -m $MEM \ -name "onie" \ -boot "order=cd,once=d" -cdrom "$ONIE_RECOVERY_ISO" \ diff --git a/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/AS13-32H/port_config.ini b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/AS13-32H/port_config.ini new file mode 100644 index 000000000000..5c6ca5db0a7b --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/AS13-32H/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias index +Ethernet1 1,2,3,4 QSFP1 1 +Ethernet2 5,6,7,8 QSFP2 2 +Ethernet3 9,10,11,12 QSFP3 3 +Ethernet4 13,14,15,16 QSFP4 4 +Ethernet5 17,18,19,20 QSFP5 5 +Ethernet6 21,22,23,24 QSFP6 6 +Ethernet7 25,26,27,28 QSFP7 7 +Ethernet8 29,30,31,32 QSFP8 8 +Ethernet9 33,34,35,36 QSFP9 9 +Ethernet10 37,38,39,40 QSFP10 10 +Ethernet11 41,42,43,44 QSFP11 11 +Ethernet12 45,46,47,48 QSFP12 12 +Ethernet13 49,50,51,52 QSFP13 13 +Ethernet14 53,54,55,56 QSFP14 14 +Ethernet15 57,58,59,60 QSFP15 15 +Ethernet16 61,62,63,64 QSFP16 16 +Ethernet17 65,66,67,68 QSFP17 17 +Ethernet18 69,70,71,72 QSFP18 18 +Ethernet19 73,74,75,76 QSFP19 19 +Ethernet20 77,78,79,80 QSFP20 20 +Ethernet21 81,82,83,84 QSFP21 21 +Ethernet22 85,86,87,88 QSFP22 22 +Ethernet23 89,90,91,92 QSFP23 23 +Ethernet24 93,94,95,96 QSFP24 24 +Ethernet25 97,98,99,100 QSFP25 25 +Ethernet26 101,102,103,104 QSFP26 26 +Ethernet27 105,106,107,108 QSFP27 27 +Ethernet28 109,110,111,112 QSFP28 28 +Ethernet29 113,114,115,116 QSFP29 29 +Ethernet30 117,118,119,120 QSFP30 30 +Ethernet31 121,122,123,124 QSFP31 31 +Ethernet32 125,126,127,128 QSFP32 32 diff --git a/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/AS13-32H/sai.profile b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/AS13-32H/sai.profile new file mode 100644 index 000000000000..53028311b8c3 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/AS13-32H/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/platform/td3-as13-32h.config.bcm diff --git a/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/custom_led.bin b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/custom_led.bin new file mode 100644 index 000000000000..91552022dc6f Binary files /dev/null and b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/custom_led.bin differ diff --git a/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/default_sku b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/default_sku new file mode 100644 index 000000000000..d47b50be8491 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/default_sku @@ -0,0 +1 @@ +AS13-32H t1 \ No newline at end of file diff --git a/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/installer.conf b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/installer.conf new file mode 100644 index 000000000000..dc3cf67d19e7 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/installer.conf @@ -0,0 +1,2 @@ +CONSOLE_SPEED=9600 +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="processor.max_cstate=1 intel_idle.max_cstate=0" diff --git a/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/led_proc_init.soc b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/led_proc_init.soc new file mode 100644 index 000000000000..28cd4b9bc9f7 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/led_proc_init.soc @@ -0,0 +1,9 @@ +#Enable all ports +#port all en=1 +#sleep 6 +#linkscan 250000; port xe,ce linkscan=on + +#Load LED +#led auto on; led start + + diff --git a/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/linkscan_led_fw.bin b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/linkscan_led_fw.bin new file mode 100644 index 000000000000..a6a4794ecc2b Binary files /dev/null and b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/linkscan_led_fw.bin differ diff --git a/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/minigraph.xml b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/minigraph.xml new file mode 100644 index 000000000000..fc6552ee0193 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/minigraph.xml @@ -0,0 +1,854 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + sonic + 10.0.0.32 + 1 + 180 + 60 + + + sonic + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + sonic + 10.0.0.34 + 1 + 180 + 60 + + + sonic + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + sonic + 10.0.0.36 + 1 + 180 + 60 + + + sonic + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + sonic + 10.0.0.38 + 1 + 180 + 60 + + + sonic + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + sonic + 10.0.0.40 + 1 + 180 + 60 + + + sonic + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + sonic + 10.0.0.42 + 1 + 180 + 60 + + + sonic + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + sonic + 10.0.0.44 + 1 + 180 + 60 + + + sonic + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + sonic + 10.0.0.46 + 1 + 180 + 60 + + + sonic + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + sonic + 10.0.0.48 + 1 + 180 + 60 + + + sonic + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + sonic + 10.0.0.50 + 1 + 180 + 60 + + + sonic + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + sonic + 10.0.0.52 + 1 + 180 + 60 + + + sonic + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + sonic + 10.0.0.54 + 1 + 180 + 60 + + + sonic + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + sonic + 10.0.0.56 + 1 + 180 + 60 + + + sonic + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + sonic + 10.0.0.58 + 1 + 180 + 60 + + + sonic + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + sonic + 10.0.0.60 + 1 + 180 + 60 + + + sonic + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + sonic + 10.0.0.62 + 1 + 180 + 60 + + + sonic + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + sonic + + +
10.0.0.33
+ + +
+ +
10.0.0.1
+ + +
+ +
10.0.0.35
+ + +
+ +
10.0.0.3
+ + +
+ +
10.0.0.37
+ + +
+ +
10.0.0.5
+ + +
+ +
10.0.0.39
+ + +
+ +
10.0.0.7
+ + +
+ +
10.0.0.41
+ + +
+ +
10.0.0.9
+ + +
+ +
10.0.0.43
+ + +
+ +
10.0.0.11
+ + +
+ +
10.0.0.45
+ + +
+ +
10.0.0.13
+ + +
+ +
10.0.0.47
+ + +
+ +
10.0.0.15
+ + +
+ +
10.0.0.49
+ + +
+ +
10.0.0.17
+ + +
+ +
10.0.0.51
+ + +
+ +
10.0.0.19
+ + +
+ +
10.0.0.53
+ + +
+ +
10.0.0.21
+ + +
+ +
10.0.0.55
+ + +
+ +
10.0.0.23
+ + +
+ +
10.0.0.57
+ + +
+ +
10.0.0.25
+ + +
+ +
10.0.0.59
+ + +
+ +
10.0.0.27
+ + +
+ +
10.0.0.61
+ + +
+ +
10.0.0.29
+ + +
+ +
10.0.0.63
+ + +
+ +
10.0.0.31
+ + +
+
+ +
+ + 64001 + ARISTA01T0 + + + + 65200 + ARISTA01T2 + + + + 64002 + ARISTA02T0 + + + + 65200 + ARISTA02T2 + + + + 64003 + ARISTA03T0 + + + + 65200 + ARISTA03T2 + + + + 64004 + ARISTA04T0 + + + + 65200 + ARISTA04T2 + + + + 64005 + ARISTA05T0 + + + + 65200 + ARISTA05T2 + + + + 64006 + ARISTA06T0 + + + + 65200 + ARISTA06T2 + + + + 64007 + ARISTA07T0 + + + + 65200 + ARISTA07T2 + + + + 64008 + ARISTA08T0 + + + + 65200 + ARISTA08T2 + + + + 64009 + ARISTA09T0 + + + + 65200 + ARISTA09T2 + + + + 64010 + ARISTA10T0 + + + + 65200 + ARISTA10T2 + + + + 64011 + ARISTA11T0 + + + + 65200 + ARISTA11T2 + + + + 64012 + ARISTA12T0 + + + + 65200 + ARISTA12T2 + + + + 64013 + ARISTA13T0 + + + + 65200 + ARISTA13T2 + + + + 64014 + ARISTA14T0 + + + + 65200 + ARISTA14T2 + + + + 64015 + ARISTA15T0 + + + + 65200 + ARISTA15T2 + + + + 64016 + ARISTA16T0 + + + + 65200 + ARISTA16T2 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + + + + + + sonic + + + + + + QSFP1 + 10.0.0.0/31 + + + + QSFP2 + 10.0.0.2/31 + + + + QSFP3 + 10.0.0.4/31 + + + + QSFP4 + 10.0.0.6/31 + + + + QSFP5 + 10.0.0.8/31 + + + + QSFP6 + 10.0.0.10/31 + + + + QSFP7 + 10.0.0.12/31 + + + + QSFP8 + 10.0.0.14/31 + + + + QSFP9 + 10.0.0.16/31 + + + + QSFP10 + 10.0.0.18/31 + + + + QSFP11 + 10.0.0.20/31 + + + + QSFP12 + 10.0.0.22/31 + + + + QSFP13 + 10.0.0.24/31 + + + + QSFP14 + 10.0.0.26/31 + + + + QSFP15 + 10.0.0.28/31 + + + + QSFP16 + 10.0.0.30/31 + + + + QSFP17 + 10.0.0.32/31 + + + + QSFP18 + 10.0.0.34/31 + + + + QSFP19 + 10.0.0.36/31 + + + + QSFP20 + 10.0.0.38/31 + + + + QSFP21 + 10.0.0.40/31 + + + + QSFP22 + 10.0.0.42/31 + + + + QSFP23 + 10.0.0.44/31 + + + + QSFP24 + 10.0.0.46/31 + + + + QSFP25 + 10.0.0.48/31 + + + + QSFP26 + 10.0.0.50/31 + + + + QSFP27 + 10.0.0.52/31 + + + + QSFP28 + 10.0.0.54/31 + + + + QSFP29 + 10.0.0.56/31 + + + + QSFP30 + 10.0.0.58/31 + + + + QSFP31 + 10.0.0.60/31 + + + + QSFP32 + 10.0.0.62/31 + + + + + + + + + + + + + sonic + AS13-32H + + + + + + + sonic + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + ErspanDestinationIpv4 + + 2.2.2.2 + + + + + + + sonic + AS13-32H +
diff --git a/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/opennsl-postinit.cfg b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/opennsl-postinit.cfg new file mode 100644 index 000000000000..7008c14c0ffc --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/opennsl-postinit.cfg @@ -0,0 +1,3 @@ +linkscan 250000; port xe,ce linkscan=on +sleep 1 +led auto on; led start diff --git a/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/cputemputil.py b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/cputemputil.py new file mode 100644 index 000000000000..ac2589d044fd --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/cputemputil.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python + +# +# cputemputil.py +# +# Platform-specific CPU temperature Interface for SONiC +# + +__author__ = 'Wirut G.' +__license__ = "GPL" +__version__ = "0.1.0" +__status__ = "Development" + + +import subprocess +import requests + + +class CpuTempUtil(): + """Platform-specific CpuTempUtil class""" + + def __init__(self): + pass + + def get_cpu_temp(self): + + # Get list of temperature of CPU cores. + p = subprocess.Popen(['sensors', '-Au', 'coretemp-isa-0000'], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = p.communicate() + raw_data_list = out.splitlines() + temp_string_list = [i for i, s in enumerate( + raw_data_list) if '_input' in s] + tmp_list = [0] + + for temp_string in temp_string_list: + tmp_list.append(float(raw_data_list[temp_string].split(":")[1])) + + return tmp_list + + def get_max_cpu_tmp(self): + # Get maximum temperature from list of temperature of CPU cores. + return max(self.get_cpu_temp()) diff --git a/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/eeprom.py b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/eeprom.py new file mode 100644 index 000000000000..9f42b56ce7c2 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/eeprom.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +############################################################################# +# Celestica DX010 +# +# 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, e: + raise ImportError (str(e) + "- required module not found") + + +class board(eeprom_tlvinfo.TlvInfoDecoder): + + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/class/i2c-adapter/i2c-0/0-0056/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) + diff --git a/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/fanutil.py b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/fanutil.py new file mode 100644 index 000000000000..dab2f64dd5e0 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/fanutil.py @@ -0,0 +1,310 @@ +#!/usr/bin/env python + +__author__ = 'Wirut G.' +__license__ = "GPL" +__version__ = "0.1.2" +__status__ = "Development" + +import requests +import re + + +class FanUtil(): + """Platform-specific FanUtil class""" + + def __init__(self): + + self.fan_fru_url = "http://240.1.1.1:8080/api/sys/fruid/fan" + self.sensor_url = "http://240.1.1.1:8080/api/sys/sensors" + self.fru_data_list = None + self.sensor_data_list = None + + def request_data(self): + # Reqest data from BMC if not exist. + if self.fru_data_list is None or self.sensor_data_list is None: + fru_data_req = requests.get(self.fan_fru_url) + sensor_data_req = requests.get(self.sensor_url) + fru_json = fru_data_req.json() + sensor_json = sensor_data_req.json() + self.fru_data_list = fru_json.get('Information') + self.sensor_data_list = sensor_json.get('Information') + return self.fru_data_list, self.sensor_data_list + + def name_to_index(self, fan_name): + # Get fan index from fan name + match = re.match(r"(FAN)([0-9]+)-(1|2)", fan_name, re.I) + fan_index = None + if match: + i_list = list(match.groups()) + fan_index = int(i_list[1])*2 - (int(i_list[2]) % 2) + return fan_index + + def get_num_fans(self): + """ + Get the number of fans + :return: int num_fans + """ + num_fans = 8 + + return num_fans + + def get_fan_speed(self, fan_name): + """ + Get the current speed of the fan, the unit is "RPM" + :return: int fan_speed + """ + + try: + # Get real fan index + index = self.name_to_index(fan_name) + + # Set key and index. + fan_speed = 0 + position_key = "Front" if index % 2 != 0 else "Rear" + index = int(round(float(index)/2)) + fan_key = "Fan " + str(index) + " " + position_key + + # Request and validate fan information. + self.fru_data_list, self.sensor_data_list = self.request_data() + + # Get fan's speed. + for sensor_data in self.sensor_data_list: + sensor_name = sensor_data.get('name') + if "fan" in str(sensor_name): + fan_data = sensor_data.get(fan_key) + fan_sp_list = map(int, re.findall(r'\d+', fan_data)) + fan_speed = fan_sp_list[0] + + except: + return 0 + + return fan_speed + + def get_fan_low_threshold(self, fan_name): + """ + Get the low speed threshold of the fan. + if the current speed < low speed threshold, + the status of the fan is not ok. + :return: int fan_low_threshold + """ + + try: + # Get real fan index + index = self.name_to_index(fan_name) + + # Set key and index. + fan_low_threshold = 0 + position_key = "Front" if index % 2 != 0 else "Rear" + index = int(round(float(index)/2)) + fan_key = "Fan " + str(index) + " " + position_key + + # Request and validate fan information. + self.fru_data_list, self.sensor_data_list = self.request_data() + + # Get fan's threshold. + for sensor_data in self.sensor_data_list: + sensor_name = sensor_data.get('name') + if "fan" in str(sensor_name): + fan_data = sensor_data.get(fan_key) + fan_sp_list = map(int, re.findall(r'\d+', fan_data)) + fan_low_threshold = fan_sp_list[1] + + except: + return "N/A" + + return fan_low_threshold + + def get_fan_high_threshold(self, fan_name): + """ + Get the hight speed threshold of the fan, + if the current speed > high speed threshold, + the status of the fan is not ok + :return: int fan_high_threshold + """ + + try: + # Get real fan index + index = self.name_to_index(fan_name) + + # Set key and index. + fan_high_threshold = 0 + position_key = "Front" if index % 2 != 0 else "Rear" + index = int(round(float(index)/2)) + fan_key = "Fan " + str(index) + " " + position_key + + # Request and validate fan information. + self.fru_data_list, self.sensor_data_list = self.request_data() + + # Get fan's threshold. + for sensor_data in self.sensor_data_list: + sensor_name = sensor_data.get('name') + if "fan" in str(sensor_name): + fan_data = sensor_data.get(fan_key) + fan_sp_list = map(int, re.findall(r'\d+', fan_data)) + fan_high_threshold = fan_sp_list[2] + + except: + return 0 + + return fan_high_threshold + + def get_fan_pn(self, fan_name): + """ + Get the product name of the fan + :return: str fan_pn + """ + + try: + # Get real fan index + index = self.name_to_index(fan_name) + + # Set key and index. + fan_pn = "N/A" + index = int(round(float(index)/2)) + fan_fru_key = "Fantray" + str(index) + + # Request and validate fan information. + self.fru_data_list, self.sensor_data_list = self.request_data() + + # Get fan's fru. + for fan_fru in self.fru_data_list: + matching_fan = [s for s in fan_fru if fan_fru_key in s] + if matching_fan: + pn = [s for s in fan_fru if "Part" in s] + fan_pn = pn[0].split()[4] + + except: + return "N/A" + + return fan_pn + + def get_fan_sn(self, fan_name): + """ + Get the serial number of the fan + :return: str fan_sn + """ + try: + # Get real fan index + index = self.name_to_index(fan_name) + + # Set key and index. + fan_sn = "N/A" + index = int(round(float(index)/2)) + fan_fru_key = "Fantray" + str(index) + + # Request and validate fan information. + self.fru_data_list, self.sensor_data_list = self.request_data() + + # Get fan's fru. + for fan_fru in self.fru_data_list: + matching_fan = [s for s in fan_fru if fan_fru_key in s] + if matching_fan: + serial = [s for s in fan_fru if "Serial" in s] + fan_sn = serial[0].split()[3] + + except: + return "N/A" + + return fan_sn + + def get_fans_name_list(self): + """ + Get list of fan name. + :return: list fan_names + """ + fan_names = [] + + # Get the number of fans + n_fan = self.get_num_fans() + + # Set fan name and add to the list. + for x in range(1, n_fan + 1): + f_index = int(round(float(x)/2)) + pos = 1 if x % 2 else 2 + fan_name = 'FAN{}_{}'.format(f_index, pos) + fan_names.append(fan_name) + + return fan_names + + def get_all(self): + """ + Get all information of system FANs, returns JSON objects in python 'DICT'. + Number, mandatory, max number of FAN, integer + FAN1_1, FAN1_2, ... mandatory, FAN name, string + Present, mandatory for each FAN, present status, boolean, True for present, False for NOT present, read directly from h/w + Running, conditional, if PRESENT is True, running status of the FAN, True for running, False for stopped, read directly from h/w + Speed, conditional, if PRESENT is True, real FAN speed, float, read directly from h/w + LowThd, conditional, if PRESENT is True, lower bound of FAN speed, float, read from h/w + HighThd, conditional, if PRESENT is True, upper bound of FAN speed, float, read from h/w + PN, conditional, if PRESENT is True, PN of the FAN, string + SN, conditional, if PRESENT is True, SN of the FAN, string) + """ + + self.fru_data_list, self.sensor_data_list = self.request_data() + all_fan_dict = dict() + + # Get the number of fans + n_fan = self.get_num_fans() + all_fan_dict["Number"] = n_fan + + # Set fan FRU data. + fan_fru_dict = dict() + fan_raw_idx = 1 + for fan_fru in self.fru_data_list: + fru_dict = dict() + fan_ps = False + + if len(fan_fru) == 0: + fan_idx = fan_raw_idx + fan_pn = "N/A" + fan_sn = "N/A" + else: + fan_key = fan_fru[0].split() + if str(fan_key[-1]).lower() == "absent": + fan_idx = int(re.findall('\d+', fan_key[0])[0]) + + else: + fan_idx = int(re.findall('\d+', fan_key[-1])[0]) + fan_ps = True + pn = [s for s in fan_fru if "Part" in s] + sn = [s for s in fan_fru if "Serial" in s] + fan_pn = pn[0].split( + ":")[-1].strip() if len(pn) > 0 else 'N/A' + fan_sn = sn[0].split( + ":")[-1].strip() if len(sn) > 0 else 'N/A' + + fru_dict["PN"] = "N/A" if not fan_pn or fan_pn == "" else fan_pn + fru_dict["SN"] = "N/A" if not fan_sn or fan_sn == "" else fan_sn + fru_dict["Present"] = fan_ps + fan_fru_dict[fan_idx] = fru_dict + fan_raw_idx += 1 + + # Set fan sensor data. + for sensor_data in self.sensor_data_list: + sensor_name = sensor_data.get('name') + if "fan" in str(sensor_name): + for x in range(1, n_fan + 1): + fan_dict = dict() + f_index = int(round(float(x)/2)) + pos = 1 if x % 2 else 2 + position_key = "Front" if x % 2 != 0 else "Rear" + fan_key = "Fan " + str(f_index) + " " + position_key + fan_data = sensor_data.get(fan_key) + fan_sp_list = map(int, re.findall(r'\d+', fan_data)) + fan_dict["Present"] = fan_fru_dict[f_index]["Present"] + if fan_dict["Present"] or fan_sp_list[0] > 0: + fan_dict["Present"] = True + fan_dict["Speed"] = fan_sp_list[0] + fan_dict["Running"] = True if fan_dict["Speed"] > 0 else False + fan_dict["LowThd"] = fan_sp_list[1] + fan_dict["HighThd"] = fan_sp_list[2] + fan_dict["PN"] = fan_fru_dict[f_index]["PN"] + fan_dict["SN"] = fan_fru_dict[f_index]["SN"] + fan_dict["AirFlow"] = "FTOB" if "R1241-F9001" in fan_dict["PN"] else "Unknown" + fan_dict["AirFlow"] = "BTOF" if "R1241-F9002" in fan_dict["PN"] else fan_dict["AirFlow"] + fan_dict["Status"] = True if fan_dict["AirFlow"] != "Unknown" else False + fan_name = 'FAN{}_{}'.format(f_index, pos) + all_fan_dict[fan_name] = fan_dict + break + + return all_fan_dict diff --git a/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/fwmgrutil.py b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/fwmgrutil.py new file mode 100644 index 000000000000..c1fb40cebfb8 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/fwmgrutil.py @@ -0,0 +1,882 @@ +# fwmgrutil.py +# +# Platform-specific firmware management interface for SONiC +# + +import subprocess +import requests +import os +import pexpect +import base64 +import time +import json +import logging +import ast +from datetime import datetime + +try: + from sonic_fwmgr.fwgmr_base import FwMgrUtilBase +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +class FwMgrUtil(FwMgrUtilBase): + + """Platform-specific FwMgrUtil class""" + + def __init__(self): + self.platform_name = "AS1332h" + self.onie_config_file = "/host/machine.conf" + self.bmc_info_url = "http://240.1.1.1:8080/api/sys/bmc" + self.bmc_raw_command_url = "http://240.1.1.1:8080/api/sys/raw" + self.fw_upgrade_url = "http://240.1.1.1:8080/api/sys/upgrade" + self.onie_config_file = "/host/machine.conf" + self.fw_upgrade_logger_path = "/var/log/fw_upgrade.log" + self.cpldb_version_path = "/sys/devices/platform/%s.cpldb/getreg" % self.platform_name + self.fpga_version_path = "/sys/devices/platform/%s.switchboard/FPGA/getreg" % self.platform_name + self.switchboard_cpld1_path = "/sys/devices/platform/%s.switchboard/CPLD1/getreg" % self.platform_name + self.switchboard_cpld2_path = "/sys/devices/platform/%s.switchboard/CPLD2/getreg" % self.platform_name + self.switchboard_cpld3_path = "/sys/devices/platform/%s.switchboard/CPLD3/getreg" % self.platform_name + self.switchboard_cpld4_path = "/sys/devices/platform/%s.switchboard/CPLD4/getreg" % self.platform_name + self.bmc_pwd_path = "/usr/local/etc/bmcpwd" + + def __get_register_value(self, path, register): + cmd = "echo {1} > {0}; cat {0}".format(path, register) + p = subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + raw_data, err = p.communicate() + if err is not '': + return 'None' + else: + return raw_data.strip() + + def __update_fw_upgrade_logger(self, header, message): + if not os.path.isfile(self.fw_upgrade_logger_path): + cmd = "sudo touch %s && sudo chmod +x %s" % ( + self.fw_upgrade_logger_path, self.fw_upgrade_logger_path) + subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + logging.basicConfig(filename=self.fw_upgrade_logger_path, + filemode='a', + format='%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s', + datefmt='%b %d %H:%M:%S', + level=logging.INFO) + + log_message = "%s : %s" % (header, message) + if header != "last_upgrade_result": + print(log_message) + return logging.info(log_message) + + def get_bmc_pass(self): + if os.path.exists(self.bmc_pwd_path): + with open(self.bmc_pwd_path) as file: + data = file.read() + + key = "bmc" + dec = [] + enc = base64.urlsafe_b64decode(data) + for i in range(len(enc)): + key_c = key[i % len(key)] + dec_c = chr((256 + ord(enc[i]) - ord(key_c)) % 256) + dec.append(dec_c) + return "".join(dec) + return False + + def get_bmc_version(self): + """Get BMC version from SONiC + :returns: version string + + """ + bmc_version = None + + bmc_version_key = "OpenBMC Version" + bmc_info_req = requests.get(self.bmc_info_url, timeout=60) + if bmc_info_req.status_code == 200: + bmc_info_json = bmc_info_req.json() + bmc_info = bmc_info_json.get('Information') + bmc_version = bmc_info.get(bmc_version_key) + return str(bmc_version) + + def upload_file_bmc(self, fw_path): + scp_command = 'sudo scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r %s root@240.1.1.1:/home/root/' % os.path.abspath( + fw_path) + child = pexpect.spawn(scp_command) + i = child.expect(["root@240.1.1.1's password:"], timeout=30) + bmc_pwd = self.get_bmc_pass() + if i == 0 and bmc_pwd: + child.sendline(bmc_pwd) + data = child.read() + print(data) + child.close + return os.path.isfile(fw_path) + return False + + def get_cpld_version(self): + """Get CPLD version from SONiC + :returns: dict like {'CPLD_1': version_string, 'CPLD_2': version_string} + """ + + CPLD_B = self.__get_register_value(self.cpldb_version_path, '0xA100') + CPLD_C = self.__get_register_value(self.cpldb_version_path, '0xA1E0') + CPLD_1 = self.__get_register_value(self.switchboard_cpld1_path, '0x00') + CPLD_2 = self.__get_register_value(self.switchboard_cpld2_path, '0x00') + CPLD_3 = self.__get_register_value(self.switchboard_cpld3_path, '0x00') + CPLD_4 = self.__get_register_value(self.switchboard_cpld4_path, '0x00') + + fan_cpld_key = "FanCPLD Version" + fan_cpld = None + bmc_info_req = requests.get(self.bmc_info_url) + if bmc_info_req.status_code == 200: + bmc_info_json = bmc_info_req.json() + bmc_info = bmc_info_json.get('Information') + fan_cpld = bmc_info.get(fan_cpld_key) + + CPLD_B = 'None' if CPLD_B is 'None' else "{}.{}".format( + int(CPLD_B[2], 16), int(CPLD_B[3], 16)) + CPLD_C = 'None' if CPLD_C is 'None' else "{}.{}".format( + int(CPLD_C[2], 16), int(CPLD_C[3], 16)) + CPLD_1 = 'None' if CPLD_1 is 'None' else "{}.{}".format( + int(CPLD_1[2], 16), int(CPLD_1[3], 16)) + CPLD_2 = 'None' if CPLD_2 is 'None' else "{}.{}".format( + int(CPLD_2[2], 16), int(CPLD_2[3], 16)) + CPLD_3 = 'None' if CPLD_3 is 'None' else "{}.{}".format( + int(CPLD_3[2], 16), int(CPLD_3[3], 16)) + CPLD_4 = 'None' if CPLD_4 is 'None' else "{}.{}".format( + int(CPLD_4[2], 16), int(CPLD_4[3], 16)) + FAN_CPLD = 'None' if fan_cpld is None else "{}.{}".format( + int(fan_cpld[0], 16), int(fan_cpld[1], 16)) + + cpld_version_dict = {} + cpld_version_dict.update({'CPLD_B': CPLD_B}) + cpld_version_dict.update({'CPLD_C': CPLD_C}) + cpld_version_dict.update({'CPLD_1': CPLD_1}) + cpld_version_dict.update({'CPLD_2': CPLD_2}) + cpld_version_dict.update({'CPLD_3': CPLD_3}) + cpld_version_dict.update({'CPLD_4': CPLD_4}) + cpld_version_dict.update({'CPLD_FAN': FAN_CPLD}) + + return cpld_version_dict + + def get_bios_version(self): + """Get BIOS version from SONiC + :returns: version string + + """ + bios_version = None + + p = subprocess.Popen( + ["sudo", "dmidecode", "-s", "bios-version"], stdout=subprocess.PIPE) + raw_data = str(p.communicate()[0]) + if raw_data == '': + return str(None) + raw_data_list = raw_data.split("\n") + bios_version = raw_data_list[0] if len( + raw_data_list) == 1 else raw_data_list[-2] + + return str(bios_version) + + def get_onie_version(self): + """Get ONiE version from SONiC + :returns: version string + + """ + onie_verison = None + + onie_version_keys = "onie_version" + onie_config_file = open(self.onie_config_file, "r") + for line in onie_config_file.readlines(): + if onie_version_keys in line: + onie_version_raw = line.split('=') + onie_verison = onie_version_raw[1].strip() + break + onie_config_file.close() + return str(onie_verison) + + def get_pcie_version(self): + """Get PCiE version from SONiC + :returns: version dict { "PCIE_FW_LOADER": "2.5", "PCIE_FW": "D102_08" } + + """ + cmd = "sudo bcmcmd 'pciephy fw version'" + p = subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + raw_data, err = p.communicate() + + pcie_version = dict() + pcie_version["PCIE_FW_LOADER"] = 'None' + pcie_version["PCIE_FW"] = 'None' + + if err == '': + lines = raw_data.split('\n') + for line in lines: + if 'PCIe FW loader' in line: + pcie_version["PCIE_FW_LOADER"] = line.split(':')[1].strip() + elif 'PCIe FW version' in line: + pcie_version["PCIE_FW"] = line.split(':')[1].strip() + return pcie_version + + def get_fpga_version(self): + """Get FPGA version from SONiC + :returns: version string + + """ + version = self.__get_register_value(self.fpga_version_path, '0x00') + if version is not 'None': + version = "{}.{}".format( + int(version[2:][:4], 16), int(version[2:][4:], 16)) + return str(version) + + def firmware_upgrade(self, fw_type, fw_path, fw_extra=None): + """ + @fw_type MANDATORY, firmware type, should be one of the strings: 'cpld', 'fpga', 'bios', 'bmc' + @fw_path MANDATORY, target firmware file + @fw_extra OPTIONAL, extra information string, + + for fw_type 'cpld' and 'fpga': it can be used to indicate specific cpld, such as 'cpld1', 'cpld2', ... + or 'cpld_fan_come_board', etc. If None, upgrade all CPLD/FPGA firmware. for fw_type 'bios' and 'bmc', + value should be one of 'master' or 'slave' or 'both' + """ + fw_type = fw_type.lower() + bmc_pwd = self.get_bmc_pass() + if not bmc_pwd and fw_type != "fpga": + self.__update_fw_upgrade_logger( + "fw_upgrade", "fail, message=BMC credential not found") + return False + + if fw_type == 'bmc': + self.__update_fw_upgrade_logger( + "bmc_upgrade", "start BMC upgrade") + # Copy BMC image file to BMC + fw_extra_str = str(fw_extra).lower() + last_fw_upgrade = ["BMC", fw_path, fw_extra_str, "FAILED"] + upload_file = self.upload_file_bmc(fw_path) + if not upload_file: + self.__update_fw_upgrade_logger( + "fw_upgrade", "fail, message=unable to upload BMC image to BMC") + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return False + + filename_w_ext = os.path.basename(fw_path) + json_data = dict() + json_data["path"] = "root@127.0.0.1:/home/root/%s" % filename_w_ext + json_data["password"] = bmc_pwd + + # Set flash type + current_bmc = self.get_running_bmc() + flash = fw_extra_str if fw_extra_str in [ + "master", "slave", "both"] else "both" + if fw_extra_str == "pingpong": + # flash = "master" if current_bmc == "slave" else "slave" + flash = "slave" + json_data["flash"] = flash + + # Install BMC + if flash == "both": + self.__update_fw_upgrade_logger( + "bmc_upgrade", "install BMC as master mode") + json_data["flash"] = "master" + r = requests.post(self.bmc_info_url, json=json_data) + if r.status_code != 200 or 'success' not in r.json().get('result'): + self.__update_fw_upgrade_logger( + "bmc_upgrade", "fail, message=BMC API report error code %d" % r.status_code) + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return False + json_data["flash"] = "slave" + + self.__update_fw_upgrade_logger( + "bmc_upgrade", "install BMC as %s mode" % json_data["flash"]) + r = requests.post(self.bmc_info_url, json=json_data) + if r.status_code == 200 and 'success' in r.json().get('result'): + if fw_extra_str == "pingpong": + flash = "master" if current_bmc == "slave" else "slave" + self.__update_fw_upgrade_logger( + "bmc_upgrade", "switch to boot from %s" % flash) + self.set_bmc_boot_flash(flash) + self.__update_fw_upgrade_logger( + "bmc_upgrade", "reboot BMC") + if not self.reboot_bmc(): + return False + else: + self.__update_fw_upgrade_logger( + "bmc_upgrade", "reboot BMC") + reboot_dict = {} + reboot_dict["reboot"] = "yes" + r = requests.post(self.bmc_info_url, json=reboot_dict) + last_fw_upgrade[3] = "DONE" + else: + self.__update_fw_upgrade_logger( + "bmc_upgrade", "fail, message=unable to install BMC image") + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return False + + self.__update_fw_upgrade_logger( + "bmc_upgrade", "done") + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return True + + elif fw_type == 'fpga': + last_fw_upgrade = ["FPGA", fw_path, None, "FAILED"] + self.__update_fw_upgrade_logger( + "fpga_upgrade", "start FPGA upgrade") + + if not os.path.isfile(fw_path): + self.__update_fw_upgrade_logger( + "fpga_upgrade", "fail, message=FPGA image not found %s" % fw_path) + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return False + + command = 'fpga_prog ' + fw_path + print("Running command : %s" % command) + process = subprocess.Popen( + command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + while True: + output = process.stdout.readline() + if output == '' and process.poll() is not None: + break + + rc = process.returncode + if rc != 0: + self.__update_fw_upgrade_logger( + "fw_upgrade", "fail, message=unable to install FPGA") + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return False + + self.__update_fw_upgrade_logger("fpga_upgrade", "done") + last_fw_upgrade[3] = "DONE" + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + self.firmware_refresh(["FPGA"], None, None) + return True + + elif 'cpld' in fw_type: + self.__update_fw_upgrade_logger( + "cpld_upgrade", "start CPLD upgrade") + # Check input + fw_extra_str = str(fw_extra).upper() + if ":" in fw_path and ":" in fw_extra_str: + fw_path_list = fw_path.split(":") + fw_extra_str_list = fw_extra_str.split(":") + else: + fw_path_list = [fw_path] + fw_extra_str_list = [fw_extra_str] + + if len(fw_path_list) != len(fw_extra_str_list): + self.__update_fw_upgrade_logger( + "cpld_upgrade", "fail, message=invalid input") + return False + + data_list = list(zip(fw_path_list, fw_extra_str_list)) + refresh_img_path = None + cpld_result_list = ["FAILED" for i in range( + 0, len(fw_extra_str_list))] + last_fw_upgrade = ["CPLD", ":".join( + fw_path_list), ":".join(fw_extra_str_list), ":".join(cpld_result_list)] + for i in range(0, len(data_list)): + data = data_list[i] + fw_path = data[0] + fw_extra_str = data[1] + + # Set fw_extra + fw_extra_str = { + "TOP_LC_CPLD": "top_lc", + "BOT_LC_CPLD": "bottom_lc", + "FAN_CPLD": "fan", + "CPU_CPLD": "cpu", + "BASE_CPLD": "base", + "COMBO_CPLD": "combo", + "SW_CPLD1": "switch", + "SW_CPLD2": "switch", + "REFRESH_CPLD": "refresh" + }.get(fw_extra_str, None) + + if fw_extra_str == "refresh": + refresh_img_path = fw_path + del cpld_result_list[i] + del fw_extra_str_list[i] + continue + + if fw_extra_str is None: + self.__update_fw_upgrade_logger( + "cpld_upgrade", "fail, message=invalid extra information string") + continue + + # Uploading image to BMC + self.__update_fw_upgrade_logger( + "cpld_upgrade", "start %s upgrade" % data[1]) + upload_file = self.upload_file_bmc(fw_path) + if not upload_file: + self.__update_fw_upgrade_logger( + "cpld_upgrade", "fail, message=unable to upload BMC image to BMC") + continue + + filename_w_ext = os.path.basename(fw_path) + json_data = dict() + json_data["image_path"] = "root@127.0.0.1:/home/root/%s" % filename_w_ext + json_data["password"] = bmc_pwd + json_data["device"] = "cpld" + json_data["reboot"] = "no" + json_data["type"] = fw_extra_str + + # Call BMC api to install cpld image + print("Installing...") + r = requests.post(self.fw_upgrade_url, json=json_data) + if r.status_code != 200 or 'success' not in r.json().get('result'): + self.__update_fw_upgrade_logger( + "cpld_upgrade", "fail, message=invalid cpld image") + continue + + cpld_result_list[i] = "DONE" + self.__update_fw_upgrade_logger( + "cpld_upgrade", "%s upgrade done" % data[1]) + last_fw_upgrade[3] = ":".join(cpld_result_list) + self.__update_fw_upgrade_logger( + "cpld_upgrade", "done") + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + + # Refresh CPLD + refresh_img_str_list = [] + for fw_extra in fw_extra_str_list: + if "BASE_CPLD" in fw_extra or "FAN_CPLD" in fw_extra: + refresh_img_str_list.append(refresh_img_path) + else: + refresh_img_str_list.append("None") + self.firmware_refresh(None, fw_extra_str_list, + ":".join(refresh_img_str_list)) + + return True + + elif 'bios' in fw_type: + self.__update_fw_upgrade_logger( + "bios_upgrade", "start BIOS upgrade") + last_fw_upgrade = ["BIOS", fw_path, None, "FAILED"] + fw_extra_str = str(fw_extra).lower() + flash = fw_extra_str if fw_extra_str in [ + "master", "slave"] else "master" + + if not os.path.exists(fw_path): + self.__update_fw_upgrade_logger( + "bios_upgrade", "fail, message=image not found") + return False + + scp_command = 'sudo scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r %s root@240.1.1.1:/home/root/' % os.path.abspath( + fw_path) + child = pexpect.spawn(scp_command) + i = child.expect(["root@240.1.1.1's password:"], timeout=30) + if i != 0: + self.__update_fw_upgrade_logger( + "bios_upgrade", "fail, message=unable to upload image to BMC") + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return False + + child.sendline(bmc_pwd) + data = child.read() + print(data) + child.close + + json_data = dict() + json_data["data"] = "/usr/bin/ipmitool -b 1 -t 0x2c raw 0x2e 0xdf 0x57 0x01 0x00 0x01" + r = requests.post(self.bmc_raw_command_url, json=json_data) + if r.status_code != 200: + self.__update_fw_upgrade_logger( + "bios_upgrade", "fail, message=unable to set state") + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return False + + filename_w_ext = os.path.basename(fw_path) + json_data = dict() + json_data["image_path"] = "root@127.0.0.1:/home/root/%s" % filename_w_ext + json_data["password"] = bmc_pwd + json_data["device"] = "bios" + json_data["flash"] = flash + json_data["reboot"] = "no" + + print("Installing...") + r = requests.post(self.fw_upgrade_url, json=json_data) + if r.status_code != 200 or 'success' not in r.json().get('result'): + self.__update_fw_upgrade_logger( + "bios_upgrade", "fail, message=unable install bios") + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return False + + last_fw_upgrade[3] = "DONE" + self.__update_fw_upgrade_logger( + "bios_upgrade", "done") + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + else: + self.__update_fw_upgrade_logger( + "fw_upgrade", "fail, message=invalid firmware type") + return False + + return True + + def get_last_upgrade_result(self): + """ + Get last firmware upgrade information, inlcudes: + 1) FwType: cpld/fpga/bios/bmc(passed by method 'firmware_upgrade'), string + 2) FwPath: path and file name of firmware(passed by method 'firmware_upgrade'), string + 3) FwExtra: designated string, econdings of this string is determined by vendor(passed by method 'firmware_program') + 4) Result: indicates whether the upgrade action is performed and success/failure status if performed. Values should be one of: "DONE"/"FAILED"/"NOT_PERFORMED". + list of object: + [ + { + "FwType": "cpld", + "FwPath": "cpu_cpld.vme" + "FwExtra":"CPU_CPLD" + "Result": "DONE" + }, + { + "FwType": "cpld", + "FwPath": "fan_cpld.vme" + "FwExtra": "FAN_CPLD" + "Result": "FAILED" + } + ] + """ + last_update_list = [] + + if os.path.exists(self.fw_upgrade_logger_path): + with open(self.fw_upgrade_logger_path, 'r') as file: + lines = file.read().splitlines() + + upgrade_txt = [i for i in reversed( + lines) if "last_upgrade_result" in i] + if len(upgrade_txt) > 0: + last_upgrade_txt = upgrade_txt[0].split( + "last_upgrade_result : ") + last_upgrade_list = ast.literal_eval(last_upgrade_txt[1]) + for x in range(0, len(last_upgrade_list[1].split(":"))): + upgrade_dict = {} + upgrade_dict["FwType"] = last_upgrade_list[0].lower() + upgrade_dict["FwPath"] = last_upgrade_list[1].split(":")[x] + upgrade_dict["FwExtra"] = last_upgrade_list[2].split(":")[ + x] if last_upgrade_list[2] else "None" + upgrade_dict["Result"] = last_upgrade_list[3].split(":")[x] + last_update_list.append(upgrade_dict) + + return last_update_list + + def firmware_program(self, fw_type, fw_path, fw_extra=None): + """ + Program FPGA and/or CPLD firmware only, but do not refresh them + + @param fw_type value can be: FPGA, CPLD + @param fw_path a string of firmware file path, seperated by ':', it should + match the sequence of param @fw_type + @param fw_extra a string of firmware subtype, i.e CPU_CPLD, BOARD_CPLD, + FAN_CPLD, LC_CPLD, etc. Subtypes are seperated by ':' + @return True when all required firmware is program succefully, + False otherwise. + + Example: + self.firmware_program("CPLD", "/cpu_cpld.vme:/lc_cpld", \ + "CPU_CPLD:LC_CPLD") + or + self.firmware_program("FPGA", "/fpga.bin") + """ + fw_type = fw_type.lower() + bmc_pwd = self.get_bmc_pass() + if not bmc_pwd and fw_type != "fpga": + self.__update_fw_upgrade_logger( + "fw_upgrade", "fail, message=BMC credential not found") + return False + + if fw_type == 'fpga': + last_fw_upgrade = ["FPGA", fw_path, None, "FAILED"] + self.__update_fw_upgrade_logger( + "fpga_upgrade", "start FPGA upgrade") + + if not os.path.isfile(fw_path): + self.__update_fw_upgrade_logger( + "fpga_upgrade", "fail, message=FPGA image not found %s" % fw_path) + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return False + + command = 'fpga_prog ' + fw_path + print("Running command: %s" % command) + process = subprocess.Popen( + command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + while True: + output = process.stdout.readline() + if output == '' and process.poll() is not None: + break + + rc = process.returncode + if rc != 0: + self.__update_fw_upgrade_logger( + "fw_upgrade", "fail, message=Unable to install FPGA") + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return False + + self.__update_fw_upgrade_logger("fpga_upgrade", "done") + last_fw_upgrade[3] = "DONE" + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return True + + elif 'cpld' in fw_type: + self.__update_fw_upgrade_logger( + "cpld_upgrade", "start CPLD upgrade") + + # Check input + fw_extra_str = str(fw_extra).upper() + if ":" in fw_path and ":" in fw_extra_str: + fw_path_list = fw_path.split(":") + fw_extra_str_list = fw_extra_str.split(":") + else: + fw_path_list = [fw_path] + fw_extra_str_list = [fw_extra_str] + + if len(fw_path_list) != len(fw_extra_str_list): + self.__update_fw_upgrade_logger( + "cpld_upgrade", "fail, message=Invalid input") + return False + + cpld_result_list = [] + data_list = list(zip(fw_path_list, fw_extra_str_list)) + for data in data_list: + fw_path = data[0] + fw_extra_str = data[1] + + # Set fw_extra + fw_extra_str = { + "TOP_LC_CPLD": "top_lc", + "BOT_LC_CPLD": "bottom_lc", + "FAN_CPLD": "fan", + "CPU_CPLD": "cpu", + "BASE_CPLD": "base", + "COMBO_CPLD": "combo", + "SW_CPLD1": "switch", + "SW_CPLD2": "switch" + }.get(fw_extra_str, None) + + self.__update_fw_upgrade_logger( + "cpld_upgrade", "start %s upgrade" % data[1]) + upgrade_result = "FAILED" + for x in range(1, 4): + # Set fw_extra + if x > 1: + self.__update_fw_upgrade_logger( + "cpld_upgrade", "fail, message=Retry to upgrade %s" % data[1]) + + elif fw_extra_str is None: + self.__update_fw_upgrade_logger( + "cpld_upgrade", "fail, message=Invalid extra information string %s" % data[1]) + break + elif not os.path.isfile(os.path.abspath(fw_path)): + self.__update_fw_upgrade_logger( + "cpld_upgrade", "fail, message=CPLD image not found %s" % fw_path) + break + + # Install cpld image via ispvm tool + print("Installing...") + command = 'ispvm %s' % fw_path + if fw_extra_str in ["top_lc", "bottom_lc"]: + option = 1 if fw_extra_str == "top_lc" else 2 + command = "ispvm -c %d %s" % (option, + os.path.abspath(fw_path)) + print("Running command : %s" % command) + process = subprocess.Popen( + command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + while True: + output = process.stdout.readline() + if output == '' and process.poll() is not None: + break + + rc = process.returncode + if rc != 0: + self.__update_fw_upgrade_logger( + "cpld_upgrade", "fail, message=Unable to install CPLD") + continue + + upgrade_result = "DONE" + self.__update_fw_upgrade_logger("cpld_upgrade", "done") + break + cpld_result_list.append(upgrade_result) + + last_fw_upgrade = ["CPLD", ":".join( + fw_path_list), ":".join(fw_extra_str_list), ":".join(cpld_result_list)] + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return "FAILED" not in cpld_result_list + else: + self.__update_fw_upgrade_logger( + "fw_upgrade", "fail, message=Invalid firmware type") + return False + + return True + + def firmware_refresh(self, fpga_list, cpld_list, fw_extra=None): + """ + Refresh firmware and take extra action when necessary. + @param fpga_list a list of FPGA names + @param cpld_list a list of CPLD names + @return True if refresh succefully and no power cycle action is taken. + + @Note extra action should be: power cycle the whole system(except BMC) when + CPU_CPLD or BOARD_CPLD or FPGA is refreshed. + No operation if the power cycle is not needed. + + Example: + self.firmware_refresh( + ["FPGA"], ["BASE_CPLD", "LC_CPLD"],"/tmp/fw/refresh.vme") + or + self.firmware_refresh(["FPGA"], None, None) + or + self.firmware_refresh(None, ["FAN_CPLD", "LC1_CPLD", "BASE_CPLD"], + "/tmp/fw/fan_refresh.vme:none:/tmp/fw/base_refresh.vme") + """ + + if not fpga_list and not cpld_list: + return False + + if type(cpld_list) is list and ("BASE_CPLD" in cpld_list or "FAN_CPLD" in cpld_list): + refresh_list = fpga_list + \ + cpld_list if type(fpga_list) is list else cpld_list + self.__update_fw_upgrade_logger( + "fw_refresh", "start %s refresh" % ",".join(refresh_list)) + fw_path_list = fw_extra.split(':') + command = "echo " + if len(fw_path_list) != len(cpld_list): + self.__update_fw_upgrade_logger( + "cpld_refresh", "fail, message=Invalid fw_extra") + return False + + for idx in range(0, len(cpld_list)): + fw_path = fw_path_list[idx] + refresh_type = { + "BASE_CPLD": "base", + "FAN_CPLD": "fan" + }.get(cpld_list[idx], None) + + if not refresh_type: + continue + elif not self.upload_file_bmc(fw_path): + self.__update_fw_upgrade_logger( + "cpld_refresh", "fail, message=Unable to upload refresh image to BMC") + return False + else: + filename_w_ext = os.path.basename(fw_path) + + sub_command = "%s /home/root/%s > /tmp/cpld_refresh " % ( + refresh_type, filename_w_ext) + command += sub_command + + json_data = dict() + json_data["data"] = command + r = requests.post(self.bmc_raw_command_url, json=json_data) + if r.status_code != 200: + self.__update_fw_upgrade_logger( + "cpld_refresh", "fail, message=%d Invalid refresh image" % r.status_code) + return False + elif type(cpld_list) is list: + refresh_list = fpga_list + \ + cpld_list if type(fpga_list) is list else cpld_list + self.__update_fw_upgrade_logger( + "fw_refresh", "start %s refresh" % ",".join(refresh_list)) + json_data = dict() + json_data["data"] = "echo cpu_cpld > /tmp/cpld_refresh" + r = requests.post(self.bmc_raw_command_url, json=json_data) + if r.status_code != 200: + self.__update_fw_upgrade_logger( + "cpld_refresh", "fail, message=%d Unable to load new CPLD" % r.status_code) + return False + elif type(fpga_list) is list: + self.__update_fw_upgrade_logger( + "fw_refresh", "start FPGA refresh") + json_data = dict() + json_data["data"] = "echo fpga > /tmp/cpld_refresh" + r = requests.post(self.bmc_raw_command_url, json=json_data) + if r.status_code != 200: + self.__update_fw_upgrade_logger( + "cpld_refresh", "fail, message=%d Unable to load new FPGA" % r.status_code) + return False + else: + self.__update_fw_upgrade_logger( + "fw_refresh", "fail, message=Invalid input") + return False + + self.__update_fw_upgrade_logger("fw_refresh", "done") + return True + + def get_running_bmc(self): + """ + Get booting flash of running BMC. + @return a string, "master" or "slave" + """ + json_data = dict() + json_data["data"] = "/usr/local/bin/boot_info.sh" + r = requests.post(self.bmc_raw_command_url, json=json_data) + try: + boot_info_list = r.json().get('result') + for boot_info_raw in boot_info_list: + boot_info = boot_info_raw.split(":") + if "Current Boot Code Source" in boot_info[0]: + flash = "master" if "master "in boot_info[1].lower( + ) else "slave" + return flash + raise Exception( + "Error: Unable to detect booting flash of running BMC") + except Exception as e: + raise Exception(e) + + def set_bmc_boot_flash(self, flash): + """ + Set booting flash of BMC + @param flash should be "master" or "slave" + """ + if flash.lower() not in ["master", "slave"]: + return False + json_data = dict() + json_data["data"] = "source /usr/local/bin/openbmc-utils.sh;bmc_reboot %s" % flash + r = requests.post(self.bmc_raw_command_url, json=json_data) + if r.status_code != 200: + return False + return True + + def reboot_bmc(self): + """ + Reboot BMC + """ + json_data = dict() + json_data["data"] = "source /usr/local/bin/openbmc-utils.sh;bmc_reboot reboot" + r = requests.post(self.bmc_raw_command_url, json=json_data) + if r.status_code != 200: + return False + return True + + def get_current_bios(self): + """ + # Get booting bios image of current running host OS + # @return a string, "master" or "slave" + """ + json_data = dict() + json_data["data"] = "source /usr/local/bin/openbmc-utils.sh;come_boot_info" + r = requests.post(self.bmc_raw_command_url, json=json_data) + try: + cpu_boot_info_list = r.json().get('result') + for cpu_boot_info_raw in cpu_boot_info_list: + if "COMe CPU boots from BIOS" in cpu_boot_info_raw: + bios_image = "master" if "master "in cpu_boot_info_raw.lower( + ) else "slave" + return bios_image + raise Exception( + "Error: Unable to detect current running bios image") + except Exception as e: + raise Exception(e) diff --git a/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/optictemputil.py b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/optictemputil.py new file mode 100644 index 000000000000..0e5b6a1c7109 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/optictemputil.py @@ -0,0 +1,126 @@ +#!/usr/bin/env python + +# +# optictemputil.py +# +# Platform-specific Optic module temperature Interface for SONiC +# + +__author__ = 'Pradchaya P.' +__author__ = 'Wirut G.' +__license__ = "GPL" +__version__ = "1.0.0" +__status__ = "Development" + +import os +import sys +import binascii +import subprocess + +class OpticTempUtil(): + """Platform-specific OpticTempUtil class""" + + def __init__(self): + pass + + def read_eeprom_specific_bytes(self, sysfsfile_eeprom, offset, num_bytes): + eeprom_raw = [] + for i in range(0, num_bytes): + eeprom_raw.append("0x00") + + try: + sysfsfile_eeprom.seek(offset) + raw = sysfsfile_eeprom.read(num_bytes) + except IOError: + return None + + try: + for n in range(0, num_bytes): + eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) + except: + return None + + return eeprom_raw + + + def twos_comp(self, num, bits): + try: + if ((num & (1 << (bits - 1))) != 0): + num = num - (1 << bits) + return num + except: + return 0 + + + def calc_temperature(self, cal_type, eeprom_data, offset, size): + + msb = int(eeprom_data[offset], 16) + lsb = int(eeprom_data[offset + 1], 16) + + result = (msb << 8) | (lsb & 0xff) + result = self.twos_comp(result, 16) + + if cal_type == 1: + # Internal calibration + result = float(result / 256.0) + retval = '%.4f' %result + + # TODO: Should support external calibration in future. + else: + retval = 0 + + return retval + + ''' TODO: Change busnum to sysfs_sfp_i2c_client_eeprom_path from caller!!! + ''' + def get_optic_temp(self, sysfs_sfp_i2c_client_eeprom_path, port_type): + + EEPROM_ADDR = 0x50 + DOM_ADDR = 0x51 + EEPROM_OFFSET = 0 + DOM_OFFSET = 256 + + SFP_DMT_ADDR = 92 + SFP_DMT_WIDTH = 1 + SFP_TEMP_DATA_ADDR = 96 + SFP_TEMP_DATA_WIDTH = 2 + + QSFP_TEMP_DATA_ADDR = 22 + QSFP_TEMP_DATA_WIDTH = 2 + temperature_raw = None + + + ''' Open file here ''' + try: + sysfsfile_eeprom = open(sysfs_sfp_i2c_client_eeprom_path, mode="rb", buffering=0) + except IOError: + print("Error: reading sysfs file %s" % sysfs_sfp_i2c_client_eeprom_path) + return 0 + + if port_type == 'QSFP': + + # QSFP only have internal calibration mode. + cal_type = 1 + # read temperature raw value + temperature_raw = self.read_eeprom_specific_bytes(sysfsfile_eeprom,(EEPROM_OFFSET+QSFP_TEMP_DATA_ADDR),QSFP_TEMP_DATA_WIDTH) + else: + # read calibration type at bit 5 + cal_type = self.read_eeprom_specific_bytes(sysfsfile_eeprom,EEPROM_OFFSET+SFP_DMT_ADDR,SFP_DMT_WIDTH) + if cal_type is None: + return 0 + else: + cal_type = (int(cal_type[0],16) >> 5 ) & 1 + # read temperature raw value + temperature_raw = self.read_eeprom_specific_bytes(sysfsfile_eeprom,(DOM_OFFSET+SFP_TEMP_DATA_ADDR),SFP_TEMP_DATA_WIDTH) + + try: + sysfsfile_eeprom.close() + except IOError: + print("Error: closing sysfs file %s" % file_path) + return 0 + + #calculate temperature + if temperature_raw is not None: + return self.calc_temperature(cal_type, temperature_raw, 0, 2) + else: + return 0 \ No newline at end of file diff --git a/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/psuutil.py b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/psuutil.py new file mode 100644 index 000000000000..d3a27117f5a2 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/psuutil.py @@ -0,0 +1,248 @@ +#!/usr/bin/env python + +__author__ = 'Wirut G.' +__license__ = "GPL" +__version__ = "0.1.4" +__status__ = "Development" + +import requests +import re + +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.fru_status_url = "http://240.1.1.1:8080/api/sys/fruid/status" + self.psu_info_url = "http://240.1.1.1:8080/api/sys/fruid/psu" + + self.fru_status_list = None + self.psu_info_list = None + + def request_data(self): + # Reqest data from BMC if not exist. + if self.fru_status_list is None or self.psu_info_list is None: + fru_status_req = requests.get(self.fru_status_url) + psu_info_req = requests.get(self.psu_info_url) + fru_status_json = fru_status_req.json() + psu_info_json = psu_info_req.json() + self.fru_status_list = fru_status_json.get('Information') + self.psu_info_list = psu_info_json.get('Information') + return self.fru_status_list, self.psu_info_list + + def airflow_selector(self, pn): + # Set airflow type + pn = pn.upper() + if "DPS-1100FB" in pn: + airflow = "FTOB" + elif "DPS-1100AB" in pn: + airflow = "BTOF" + elif "FSJ026-A20G" in pn: + airflow = "FTOB" + elif "FSJ038-A20G" in pn: + airflow = "BTOF" + else: + airflow = "Unknown" + return airflow + + 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 + """ + + num_psus = 2 + + return num_psus + + 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 + """ + + # init data + psu_key = "PSU" + str(index) + psu_status_key = "Power Status" + psu_power_status = False + + try: + # Request and validate sensor's information + self.fru_status_list, self.psu_info_list = self.request_data() + + # Get PSU power status. + for fru_status in self.fru_status_list: + is_psu = fru_status.get(psu_key) + psu_status = str(fru_status.get(psu_status_key)).strip() + + if is_psu is not None and psu_status == "OK": + psu_power_status = True + + except: + print("Error: Unable to access PSU power status") + return False + + return psu_power_status + + 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 + """ + + # Init data + psu_key = "PSU" + str(index) + psu_presence_key = "Present" + psu_presence_status = False + + try: + # Request and validate sensor's information. + self.fru_status_list, self.psu_info_list = self.request_data() + + # Get PSU present status. + for fru_status in self.fru_status_list: + is_psu = fru_status.get(psu_key) + psu_status = str(fru_status.get(psu_presence_key)).strip() + + if is_psu is not None and psu_status == "Present": + psu_presence_status = True + + except: + print("Error: Unable to access PSU presence status") + return False + + return psu_presence_status + + def get_psu_sn(self, index): + """ + Get the serial number of the psu, + + :param index: An integer, 1-based index of the PSU. + :return: Serial number + """ + serial_number = "N/A" + psu_key = "PSU" + str(index) + " FRU" + psu_sn_key = "Serial Number" + + try: + # Request and validate sensor's information. + self.fru_status_list, self.psu_info_list = self.request_data() + + # Get PSU fru info. + for psu_fru in self.psu_info_list: + psu_sn = str(psu_fru.get(psu_sn_key)).strip() + if psu_fru.get(psu_key) is not None: + serial_number = psu_sn if psu_sn.strip() != "" else "N/A" + break + + except: + return "N/A" + + return serial_number + + def get_psu_pn(self, index): + """ + Get the product name of the psu + + :param index: An integer, 1-based index of the PSU. + :return: Product name + """ + product_name = "N/A" + psu_key = "PSU" + str(index) + " FRU" + psu_pn_key = "Product Name" + + try: + # Request and validate sensor's information + self.fru_status_list, self.psu_info_list = self.request_data() + + # Get PSU fru info. + for psu_fru in self.psu_info_list: + psu_pn = str(psu_fru.get(psu_pn_key)).strip() + if psu_fru.get(psu_key) is not None: + product_name = psu_pn if psu_pn.strip() != "" else "N/A" + break + + except: + return "N/A" + + return product_name + + def get_all(self): + """ + Number: mandatory, max number of PSU, integer + PSU1, PSU2, ...: mandatory, PSU name, string + Present: mandatory for each PSU, present status, boolean, True for present, False for NOT present + PowerStatus: conditional, if PRESENT is True, power status of PSU,boolean, True for powered, False for NOT powered + PN, conditional, if PRESENT is True, PN of the PSU, string + SN, conditional, if PRESENT is True, SN of the PSU, string + """ + + # Init data + all_psu_dict = dict() + all_psu_dict["Number"] = self.get_num_psus() + psu_sn_key_1 = "Serial Number" + psu_sn_key_2 = "Product Serial" + psu_pn_key = "Product Name" + + # Request and validate sensor's information. + self.fru_status_list, self.psu_info_list = self.request_data() + + # Set PSU FRU data. + psu_info_dict = dict() + for psu_fru in self.psu_info_list: + psu_data = dict() + pn = psu_fru.get(psu_pn_key) + sn = psu_fru.get(psu_sn_key_1) or psu_fru.get(psu_sn_key_2) + psu_data["PN"] = "N/A" if not pn or str( + pn).strip() == "" else str(pn).strip() + psu_data["SN"] = "N/A" if not pn or str( + pn).strip() == "" else str(sn).strip() + + fru_check = [psu_fru[v] for v in psu_fru.keys() if 'FRU Info' in v] + non_fru_check = [v for v in psu_fru.keys() if 'PSU' in v] + + if len(non_fru_check) > 0: + psu_idx = int(re.findall('\d+', non_fru_check[0])[0]) + psu_info_dict[psu_idx] = psu_data + elif len(fru_check) > 0: + psu_idx = int(re.findall('\d+', fru_check[0])[0]) + psu_info_dict[psu_idx] = psu_data + + # Set PSU status. + for fru_status in self.fru_status_list: + psu_status_dict = dict() + find_psu = [v for v in fru_status.keys() if "PSU" in v] + if len(find_psu) > 0: + psu_idx = int(re.findall('\d+', find_psu[0])[0]) + psu_ps_status = True if str(fru_status.get( + "Present")).strip() == "Present" else False + psu_pw_status = True if str(fru_status.get( + "Power Status")).strip() == "OK" else False + psu_pw_type = str(fru_status.get( + "Power Type")).strip() + ac_status = True if str(fru_status.get( + "AC Status")).strip().upper() == "OK" else False + + psu_status_dict["Present"] = psu_ps_status + if psu_ps_status: + psu_status_dict["PowerStatus"] = psu_pw_status + psu_status_dict["PN"] = psu_info_dict[psu_idx]["PN"] + psu_status_dict["SN"] = psu_info_dict[psu_idx]["SN"] + psu_status_dict["InputType"] = psu_pw_type + psu_status_dict["InputStatus"] = True if psu_pw_status and psu_ps_status else False + psu_status_dict["OutputStatus"] = ac_status + psu_status_dict["AirFlow"] = self.airflow_selector( + psu_status_dict["PN"]) + all_psu_dict[find_psu[0]] = psu_status_dict + + return all_psu_dict diff --git a/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/sensorutil.py b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/sensorutil.py new file mode 100644 index 000000000000..796949126ccc --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/sensorutil.py @@ -0,0 +1,369 @@ +#!/usr/bin/env python + +__author__ = 'Wirut G.' +__license__ = "GPL" +__version__ = "0.2.0" +__status__ = "Development" + +import requests + + +class SensorUtil(): + """Platform-specific SensorUtil class""" + + def __init__(self): + self.sensor_url = "http://240.1.1.1:8080/api/sys/sensors" + self.sys_fruid_url = "http://240.1.1.1:8080/api/sys/fruid/sys" + self.sensor_info_list = None + + def request_data(self): + # Reqest data from BMC if not exist. + if self.sensor_info_list is None: + sensor_data_req = requests.get(self.sensor_url) + sensor_json = sensor_data_req.json() + self.sensor_info_list = sensor_json.get('Information') + sys_fruid_req = requests.get(self.sys_fruid_url) + sys_fruid_json = sys_fruid_req.json() + self.sys_fruid_list = sys_fruid_json.get('Information') + return self.sensor_info_list + + def input_type_selector(self, unit): + # Set input type. + return { + "C": "temperature", + "V": "voltage", + "RPM": "RPM", + "A": "amp", + "W": "power" + }.get(unit, unit) + + def input_name_selector(self, sensor_name, input_name): + + self.sensor_name = { + "syscpld-i2c-0-0d": "TEMPERATURE", + "dps1100-i2c-24-58": "PSU1", + "dps1100-i2c-25-59": "PSU2", + "fancpld-i2c-8-0d": "FAN" + }.get(sensor_name, sensor_name) + + if 'dps1100' in sensor_name: + input_name = { + "fan1": self.sensor_name + "_FAN", + "iin": self.sensor_name + "_CURR_I", + "iout1": self.sensor_name + "_CURR_O", + "pin": self.sensor_name + "_POWER_I", + "pout1": self.sensor_name + "_POWER_O", + "temp1": self.sensor_name + "_TEMP1", + "temp2": self.sensor_name + "_TEMP2", + "vin": self.sensor_name + "_VOL_I", + "vout1": self.sensor_name + "_VOL_O" + }.get(input_name, input_name) + + elif 'tmp75' in sensor_name: + input_name = { + "tmp75-i2c-7-4d": "FTB_INLET_RIGHT", + "tmp75-i2c-7-4c": "FTB_INLET_LEFT", + "tmp75-i2c-7-4b": "FTB_SWITCH_OUTLET", + "tmp75-i2c-7-4a": "BTF_SWITCH_OUTLET", + "tmp75-i2c-39-48": "BTF_INLET_RIGHT", + "tmp75-i2c-39-49": "BTF_INLET_LEFT" + }.get(sensor_name, input_name) + if self.get_sys_airflow() == "FTOB" and sensor_name == "tmp75-i2c-7-4d": + input_name = "INLET_TEMP" + + if self.get_sys_airflow() == "BTOF" and sensor_name == "tmp75-i2c-39-48": + input_name = "INLET_TEMP" + + self.sensor_name = "TEMPERATURE" + + elif 'fancpld' in sensor_name: + raw_fan_input = input_name.split() + input_name = raw_fan_input[0] + \ + raw_fan_input[1] + "_" + raw_fan_input[2] + + elif 'ir35' in sensor_name or 'ir38' in sensor_name: + sensor_name_raw = sensor_name.split("-") + sensor_name = sensor_name_raw[0] + self.sensor_name = sensor_name.upper() + + return input_name.replace(" ", "_").upper() + + def get_num_sensors(self): + """ + Get the number of sensors + :return: int num_sensors + """ + + num_sensors = 0 + try: + # Request and validate sensor's information + self.sensor_info_list = self.request_data() + + # Get number of sensors. + num_sensors = len(self.sensor_info_list) + except: + print "Error: Unable to access sensor information" + return 0 + + return num_sensors + + def get_sensor_input_num(self, index): + """ + Get the number of the input items of the specified sensor + :return: int input_num + """ + + input_num = 0 + try: + # Request and validate sensor's information. + self.sensor_info_list = self.request_data() + + # Get sensor's input number. + sensor_data = self.sensor_info_list[index-1] + input_num = len(sensor_data.keys())-2 + except: + print "Error: Unable to access sensor information" + return 0 + + return input_num + + def get_sensor_name(self, index): + """ + Get the device name of the specified sensor. + for example "coretemp-isa-0000" + :return: str sensor_name + """ + + sensor_name = "N/A" + try: + # Request and validate sensor's information. + self.sensor_info_list = self.request_data() + + # Get sensor's name. + sensor_data = self.sensor_info_list[index-1] + sensor_name = sensor_data.get('name') + + except: + return "N/A" + + return sensor_name + + def get_sensor_input_name(self, sensor_index, input_index): + """ + Get the input item name of the specified input item of the + specified sensor index, for example "Physical id 0" + :return: str sensor_input_name + """ + + sensor_input_name = "N/A" + try: + # Request and validate sensor's information. + self.sensor_info_list = self.request_data() + sensor_data = self.sensor_info_list[sensor_index-1].copy() + + # Remove none input key. + del sensor_data["name"] + del sensor_data["Adapter"] + + # Get sensor's input name. + sensor_data_key = sensor_data.keys() + sensor_input_name = sensor_data_key[input_index-1] + except: + return "N/A" + + return sensor_input_name + + def get_sensor_input_type(self, sensor_index, input_index): + """ + Get the item type of the specified input item of the specified sensor index, + The return value should among "valtage","temperature" + :return: str sensor_input_type + """ + + sensor_input_type = "N/A" + try: + # Request and validate sensor's information. + self.sensor_info_list = self.request_data() + sensor_data = self.sensor_info_list[sensor_index-1].copy() + + # Remove none input key. + del sensor_data["name"] + del sensor_data["Adapter"] + + # Get sensor's input type name. + sensor_data_key = sensor_data.keys() + sensor_input_raw = sensor_data.get(sensor_data_key[input_index-1]) + sensor_data_str = sensor_input_raw.split() + sensor_input_type = self.input_type_selector(sensor_data_str[1]) + except: + return "N/A" + + return sensor_input_type + + def get_sensor_input_value(self, sensor_index, input_index): + """ + Get the current value of the input item, the unit is "V" or "C" + :return: float sensor_input_value + """ + + sensor_input_value = 0 + try: + # Request and validate sensor's information. + self.sensor_info_list = self.request_data() + sensor_data = self.sensor_info_list[sensor_index-1].copy() + + # Remove none input key. + del sensor_data["name"] + del sensor_data["Adapter"] + + # Get sensor's input value. + sensor_data_key = sensor_data.keys() + sensor_input_raw = sensor_data.get(sensor_data_key[input_index-1]) + sensor_data_str = sensor_input_raw.split() + sensor_input_value = float( + sensor_data_str[0]) if sensor_data_str[0] != "N/A" else 0 + except: + print "Error: Unable to access sensor information" + return 0 + + return sensor_input_value + + def get_sensor_input_low_threshold(self, sensor_index, input_index): + """ + Get the low threshold of the value, + the status of this item is not ok if the current value 1: + sensor_input_low_threshold = l_thres * \ + 1000 if str(unit[0]).lower() == 'k' else l_thres + except: + print "Error: Unable to access sensor information" + return 0 + + return sensor_input_low_threshold + + def get_sensor_input_high_threshold(self, sensor_index, input_index): + """ + Get the high threshold of the value, + the status of this item is not ok if the current value > high_threshold + :return: float sensor_input_high_threshold + """ + + sensor_input_high_threshold = 0 + try: + # Request and validate sensor's information. + self.sensor_info_list = self.request_data() + sensor_data = self.sensor_info_list[sensor_index-1].copy() + + # Remove none input key. + del sensor_data["name"] + del sensor_data["Adapter"] + + # Get sensor's input high threshold. + sensor_data_key = sensor_data.keys() + sensor_input_raw = sensor_data.get(sensor_data_key[input_index-1]) + sensor_data_str = sensor_input_raw.split() + indices = [i for i, s in enumerate( + sensor_data_str) if 'max' in s or 'high' in s] + h_thres = float( + sensor_data_str[indices[0] + 2]) if len(indices) != 0 else 0 + unit = sensor_data_str[indices[0] + + 3] if len(indices) != 0 else None + if unit is not None and len(unit) > 1: + sensor_input_high_threshold = h_thres * \ + 1000 if str(unit[0]).lower() == 'k' else h_thres + + except: + print "Error: Unable to access sensor information" + return 0 + + return sensor_input_high_threshold + + def get_sys_airflow(self): + sys_air_flow = "Unknown" + sys_pn_data = [ + v.split(":") for v in self.sys_fruid_list if "Product Part Number" in v] + + if len(sys_pn_data) == 0: + return sys_air_flow + + sys_pn = sys_pn_data[0][1] + if "R1241-F0001" in sys_pn: + sys_air_flow = "FTOB" + elif"R1241-F0002" in sys_pn: + sys_air_flow = "BTOF" + + return sys_air_flow + + def get_all(self): + + all_sensor_dict = dict() + + # Request sensor's information. + self.sensor_info_list = self.request_data() + for sensor_data in self.sensor_info_list: + sensor_info = sensor_data.copy() + + # Remove none unuse key. + del sensor_info["name"] + del sensor_info["Adapter"] + + # Set sensor data. + sensor_dict = dict() + for k, v in sensor_info.items(): + sensor_i_dict = dict() + sensor_data_str = v.split() + indices_h = [i for i, s in enumerate( + sensor_data_str) if 'max' in s or 'high' in s] + indices_l = [i for i, s in enumerate( + sensor_data_str) if 'min' in s or 'low' in s] + h_thres = float( + sensor_data_str[indices_h[0] + 2]) if len(indices_h) != 0 else 0 + l_thres = float( + sensor_data_str[indices_l[0] + 2]) if len(indices_l) != 0 else 0 + thres_unit = sensor_data_str[-1] + + sensor_i_dict["Type"] = self.input_type_selector( + sensor_data_str[1]) + sensor_i_dict["Value"] = float( + sensor_data_str[0]) if sensor_data_str[0] != "N/A" else 0 + sensor_i_dict["HighThd"] = h_thres * \ + 1000 if str(thres_unit[0]).lower() == 'k' else h_thres + sensor_i_dict["LowThd"] = l_thres * \ + 1000 if str(thres_unit[0]).lower() == 'k' else l_thres + + k = self.input_name_selector(sensor_data.get('name'), k) + sensor_dict[k] = sensor_i_dict + + if all_sensor_dict.get(self.sensor_name) is None: + all_sensor_dict[self.sensor_name] = dict() + + all_sensor_dict[self.sensor_name].update(sensor_dict) + + sensor_dict = dict() + sensor_dict["Sys_AirFlow"] = self.get_sys_airflow() + all_sensor_dict["TEMPERATURE"].update(sensor_dict) + + return all_sensor_dict diff --git a/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/sfputil.py b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/sfputil.py new file mode 100755 index 000000000000..af42b8e03324 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/sfputil.py @@ -0,0 +1,246 @@ +#!/usr/bin/env python +# +# Platform-specific SFP transceiver interface for SONiC +# + +try: + import time + 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 + PORT_END = 32 + QSFP_PORT_START = 1 + QSFP_PORT_END = 32 + + EEPROM_OFFSET = 9 + PORT_INFO_PATH = '/sys/class/fishbone32_fpga' + + _port_name = "" + _port_to_eeprom_mapping = {} + _port_to_i2cbus_mapping = {} + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(self.QSFP_PORT_START, self.QSFP_PORT_END + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + @property + def port_to_i2cbus_mapping(self): + return self._port_to_i2cbus_mapping + + def get_port_name(self, port_num): + if port_num in self.qsfp_ports: + self._port_name = "QSFP" + str(port_num - self.QSFP_PORT_START + 1) + else: + self._port_name = "SFP" + str(port_num) + return self._port_name + + def get_eeprom_dom_raw(self, port_num): + if port_num in self.qsfp_ports: + # QSFP DOM EEPROM is also at addr 0x50 and thus also stored in eeprom_ifraw + return None + else: + # Read dom eeprom at addr 0x51 + return self._read_eeprom_devid(port_num, self.DOM_EEPROM_ADDR, 256) + + def __init__(self): + # Override port_to_eeprom_mapping for class initialization + eeprom_path = '/sys/bus/i2c/devices/i2c-{0}/{0}-0050/eeprom' + + for x in range(self.PORT_START, self.PORT_END+1): + self.port_to_i2cbus_mapping[x] = (x + self.EEPROM_OFFSET) + self.port_to_eeprom_mapping[x] = eeprom_path.format( + x + self.EEPROM_OFFSET) + SfpUtilBase.__init__(self) + + def _do_write_file(self, file_handle, offset, value): + file_handle.seek(offset) + file_handle.write(hex(value)) + file_handle.close() + + def get_presence(self, port_num): + + # Check for invalid port_num + if port_num not in range(self.port_start, self.port_end + 1): + return False + + # Get path for access port presence status + port_name = self.get_port_name(port_num) + sysfs_filename = "qsfp_modprs" if port_num in self.qsfp_ports else "sfp_modabs" + reg_path = "/".join([self.PORT_INFO_PATH, port_name, sysfs_filename]) + + # Read status + try: + reg_file = open(reg_path) + content = reg_file.readline().rstrip() + reg_value = int(content) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + # Module present is active low + if reg_value == 0: + return True + + return False + + def get_low_power_mode(self, port_num): + return NotImplementedError + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid QSFP port_num + if port_num not in self.qsfp_ports: + return False + + try: + port_name = self.get_port_name(port_num) + reg_file = open( + "/".join([self.PORT_INFO_PATH, port_name, "qsfp_lpmode"]), "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = hex(lpmode) + + reg_file.seek(0) + reg_file.write(content) + reg_file.close() + + return True + + def reset(self, port_num): + # Check for invalid QSFP port_num + if port_num not in self.qsfp_ports: + return False + + try: + port_name = self.get_port_name(port_num) + reg_file = open( + "/".join([self.PORT_INFO_PATH, port_name, "qsfp_reset"]), "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + # Convert our register value back to a hex string and write back + reg_file.seek(0) + reg_file.write(hex(0)) + reg_file.close() + + # Sleep 1 second to allow it to settle + time.sleep(1) + + # Flip the bit back high and write back to the register to take port out of reset + try: + reg_file = open( + "/".join([self.PORT_INFO_PATH, port_name, "qsfp_reset"]), "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_file.seek(0) + reg_file.write(hex(1)) + reg_file.close() + + return True + + def get_transceiver_change_event(self, timeout=0): + """ + TBD + """ + return NotImplementedError + + def tx_disable(self, port_num, disable): + """ + @param port_num index of physical port + @param disable, True -- disable port tx signal + False -- enable port tx signal + @return True when operation success, False on failure. + """ + TX_DISABLE_BYTE_OFFSET = 86 + if port_num not in range(self.port_start, self.port_end + 1) or type(disable) != bool: + return False + + # QSFP, set eeprom to disable tx + if port_num in self.qsfp_ports: + presence = self.get_presence(port_num) + if not presence: + return True + + disable = b'\x0f' if disable else b'\x00' + # open eeprom + try: + with open(self.port_to_eeprom_mapping[port_num], mode="wb", buffering=0) as sysfsfile: + sysfsfile.seek(TX_DISABLE_BYTE_OFFSET) + sysfsfile.write(bytearray(disable)) + except IOError: + return False + except: + return False + + # SFP, set tx_disable pin + else: + try: + disable = hex(1) if disable else hex(0) + port_name = self.get_port_name(port_num) + reg_file = open( + "/".join([self.PORT_INFO_PATH, port_name, "sfp_txdisable"]), "w") + reg_file.write(disable) + reg_file.close() + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + return True + + def reset_all(self): + result = True + port_sysfs_path = [] + for port in range(self.port_start, self.port_end+1): + if port not in self.qsfp_ports: + continue + + presence = self.get_presence(port) + if not presence: + continue + + try: + port_name = self.get_port_name(port) + sysfs_path = "/".join([self.PORT_INFO_PATH, + port_name, "qsfp_reset"]) + reg_file = open(sysfs_path, "w") + port_sysfs_path.append(sysfs_path) + except IOError as e: + result = False + continue + + self._do_write_file(reg_file, 0, 0) + + time.sleep(1) + + for sysfs_path in port_sysfs_path: + try: + reg_file = open(sysfs_path, "w") + except IOError as e: + result = False + continue + + self._do_write_file(reg_file, 0, 1) + + return result diff --git a/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/td3-as13-32h.config.bcm b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/td3-as13-32h.config.bcm new file mode 100644 index 000000000000..82b47b51fc1e --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/td3-as13-32h.config.bcm @@ -0,0 +1,599 @@ +help_cli_enable=1 +ifp_inports_support_enable=1 +ipv6_lpm_128b_enable=0x1 +l2_mem_entries=32768 +l2xmsg_mode=1 +l3_max_ecmp_mode=1 +l3_mem_entries=16384 +lpm_scaling_enable=1 +max_vp_lags=0 +mem_cache_enable=0 +memlist_enable=1 +miim_intr_enable=0 +module_64ports=1 +oversubscribe_mode=1 +parity_enable=0 +serdes_lane_config_dfe=on +#serdes_fec_enable=1 +serdes_if_type_ce=14 +pbmp_gport_stack.0=0x0000000000000000000000000000000000000000000000000000000000000000 +#pbmp_xport_xe=0x48878787f8787808dfe1e0203e1e1e022 +pbmp_xport_xe=0x88888888888888882222222222222222 + +#ptp_ts_pll_fref=50000000 +#ptp_bs_fref_0=50000000 +#ptp_bs_fref_1=50000000 +#cls_cmd_daemon=0 + +portmap_1.0=1:100 +portmap_5.0=5:100 +portmap_9.0=9:100 +portmap_13.0=13:100 +portmap_17.0=17:100 +portmap_21.0=21:100 +portmap_25.0=25:100 +portmap_29.0=29:100 +portmap_33.0=33:100 +portmap_37.0=37:100 +portmap_41.0=41:100 +portmap_45.0=45:100 +portmap_49.0=49:100 +portmap_53.0=53:100 +portmap_57.0=57:100 +portmap_61.0=61:100 +portmap_67.0=65:100 +portmap_71.0=69:100 +portmap_75.0=73:100 +portmap_79.0=77:100 +portmap_83.0=81:100 +portmap_87.0=85:100 +portmap_91.0=89:100 +portmap_95.0=93:100 +portmap_99.0=97:100 +portmap_103.0=101:100 +portmap_107.0=105:100 +portmap_111.0=109:100 +portmap_115.0=113:100 +portmap_119.0=117:100 +portmap_123.0=121:100 +portmap_127.0=125:100 +portmap_66.0=129:10:m +portmap_130.0=128:10:m + +#wc0 lane swap +phy_chain_tx_lane_map_physical{1.0}=0x0132 +phy_chain_rx_lane_map_physical{1.0}=0x3210 + +#wc1 lane swap +phy_chain_tx_lane_map_physical{5.0}=0x2301 +phy_chain_rx_lane_map_physical{5.0}=0x2031 + +#wc2 lane swap +phy_chain_tx_lane_map_physical{9.0}=0x0132 +phy_chain_rx_lane_map_physical{9.0}=0x3210 + +#wc3 lane swap +phy_chain_tx_lane_map_physical{13.0}=0x3201 +phy_chain_rx_lane_map_physical{13.0}=0x2031 + +#wc4 lane swap +phy_chain_tx_lane_map_physical{17.0}=0x0123 +phy_chain_rx_lane_map_physical{17.0}=0x3210 + +#wc5 lane swap +phy_chain_tx_lane_map_physical{21.0}=0x2301 +phy_chain_rx_lane_map_physical{21.0}=0x2031 + +#wc6 lane swap +phy_chain_tx_lane_map_physical{25.0}=0x0123 +phy_chain_rx_lane_map_physical{25.0}=0x3210 + +#wc7 lane swap +phy_chain_tx_lane_map_physical{29.0}=0x3201 +phy_chain_rx_lane_map_physical{29.0}=0x2031 + +#wc8 lane swap +phy_chain_tx_lane_map_physical{33.0}=0x0213 +phy_chain_rx_lane_map_physical{33.0}=0x1302 + +#wc9 lane swap +phy_chain_tx_lane_map_physical{37.0}=0x1302 +phy_chain_rx_lane_map_physical{37.0}=0x2031 + +#wc10 lane swap +phy_chain_tx_lane_map_physical{41.0}=0x0231 +phy_chain_rx_lane_map_physical{41.0}=0x3120 + +#wc11 lane swap +phy_chain_tx_lane_map_physical{45.0}=0x1302 +phy_chain_rx_lane_map_physical{45.0}=0x2031 + +#wc12 lane swap +phy_chain_tx_lane_map_physical{49.0}=0x2103 +phy_chain_rx_lane_map_physical{49.0}=0x3120 + +#wc13 lane swap +phy_chain_tx_lane_map_physical{53.0}=0x2301 +phy_chain_rx_lane_map_physical{53.0}=0x2031 + +#wc14 lane swap +phy_chain_tx_lane_map_physical{57.0}=0x0123 +phy_chain_rx_lane_map_physical{57.0}=0x2301 + +#wc15 lane swap +phy_chain_tx_lane_map_physical{61.0}=0x3210 +phy_chain_rx_lane_map_physical{61.0}=0x1032 + +#wc16 lane swap +phy_chain_tx_lane_map_physical{65.0}=0x3210 +phy_chain_rx_lane_map_physical{65.0}=0x1023 + +#wc17 lane swap +phy_chain_tx_lane_map_physical{69.0}=0x0123 +phy_chain_rx_lane_map_physical{69.0}=0x1302 + +#wc18 lane swap +phy_chain_tx_lane_map_physical{73.0}=0x2301 +phy_chain_rx_lane_map_physical{73.0}=0x1032 + +#wc19 lane swap +phy_chain_tx_lane_map_physical{77.0}=0x2013 +phy_chain_rx_lane_map_physical{77.0}=0x3120 + +#wc20 lane swap +phy_chain_tx_lane_map_physical{81.0}=0x1302 +phy_chain_rx_lane_map_physical{81.0}=0x2031 + +#wc21 lane swap +phy_chain_tx_lane_map_physical{85.0}=0x0123 +phy_chain_rx_lane_map_physical{85.0}=0x2130 + +#wc22 lane swap +phy_chain_tx_lane_map_physical{89.0}=0x2301 +phy_chain_rx_lane_map_physical{89.0}=0x2031 + +#wc23 lane swap +phy_chain_tx_lane_map_physical{93.0}=0x0312 +phy_chain_rx_lane_map_physical{93.0}=0x2310 + +#wc24 lane swap +phy_chain_tx_lane_map_physical{97.0}=0x2301 +phy_chain_rx_lane_map_physical{97.0}=0x1032 + +#wc25 lane swap +phy_chain_tx_lane_map_physical{101.0}=0x0123 +phy_chain_rx_lane_map_physical{101.0}=0x3210 + +#wc26 lane swap +phy_chain_tx_lane_map_physical{105.0}=0x2301 +phy_chain_rx_lane_map_physical{105.0}=0x1032 + +#wc27 lane swap +phy_chain_tx_lane_map_physical{109.0}=0x0123 +phy_chain_rx_lane_map_physical{109.0}=0x3210 + +#wc28 lane swap +phy_chain_tx_lane_map_physical{113.0}=0x2301 +phy_chain_rx_lane_map_physical{113.0}=0x2031 + +#wc29 lane swap +phy_chain_tx_lane_map_physical{117.0}=0x0123 +phy_chain_rx_lane_map_physical{117.0}=0x3210 + +#wc30 lane swap +phy_chain_tx_lane_map_physical{121.0}=0x2301 +phy_chain_rx_lane_map_physical{121.0}=0x1032 + +#wc31 lane swap +phy_chain_tx_lane_map_physical{125.0}=0x0123 +phy_chain_rx_lane_map_physical{125.0}=0x3210 + +#MC lane swap +phy_chain_tx_lane_map_physical{129.0}=0x3210 +phy_chain_rx_lane_map_physical{129.0}=0x3210 + + +#wc0 P/N flip +phy_chain_tx_polarity_flip_physical{1.0}=0x0 +phy_chain_rx_polarity_flip_physical{1.0}=0x0 +phy_chain_tx_polarity_flip_physical{2.0}=0x0 +phy_chain_rx_polarity_flip_physical{2.0}=0x1 +phy_chain_tx_polarity_flip_physical{3.0}=0x0 +phy_chain_rx_polarity_flip_physical{3.0}=0x0 +phy_chain_tx_polarity_flip_physical{4.0}=0x1 +phy_chain_rx_polarity_flip_physical{4.0}=0x1 + +#wc1 P/N flip +phy_chain_tx_polarity_flip_physical{5.0}=0x0 +phy_chain_rx_polarity_flip_physical{5.0}=0x0 +phy_chain_tx_polarity_flip_physical{6.0}=0x1 +phy_chain_rx_polarity_flip_physical{6.0}=0x1 +phy_chain_tx_polarity_flip_physical{7.0}=0x0 +phy_chain_rx_polarity_flip_physical{7.0}=0x1 +phy_chain_tx_polarity_flip_physical{8.0}=0x1 +phy_chain_rx_polarity_flip_physical{8.0}=0x1 + +#wc2 P/N flip +phy_chain_tx_polarity_flip_physical{9.0}=0x0 +phy_chain_rx_polarity_flip_physical{9.0}=0x0 +phy_chain_tx_polarity_flip_physical{10.0}=0x0 +phy_chain_rx_polarity_flip_physical{10.0}=0x1 +phy_chain_tx_polarity_flip_physical{11.0}=0x0 +phy_chain_rx_polarity_flip_physical{11.0}=0x0 +phy_chain_tx_polarity_flip_physical{12.0}=0x1 +phy_chain_rx_polarity_flip_physical{12.0}=0x1 + +#wc3 P/N flip +phy_chain_tx_polarity_flip_physical{13.0}=0x0 +phy_chain_rx_polarity_flip_physical{13.0}=0x0 +phy_chain_tx_polarity_flip_physical{14.0}=0x1 +phy_chain_rx_polarity_flip_physical{14.0}=0x1 +phy_chain_tx_polarity_flip_physical{15.0}=0x0 +phy_chain_rx_polarity_flip_physical{15.0}=0x1 +phy_chain_tx_polarity_flip_physical{16.0}=0x0 +phy_chain_rx_polarity_flip_physical{16.0}=0x1 + +#wc4 P/N flip +phy_chain_tx_polarity_flip_physical{17.0}=0x0 +phy_chain_rx_polarity_flip_physical{17.0}=0x0 +phy_chain_tx_polarity_flip_physical{18.0}=0x1 +phy_chain_rx_polarity_flip_physical{18.0}=0x1 +phy_chain_tx_polarity_flip_physical{19.0}=0x0 +phy_chain_rx_polarity_flip_physical{19.0}=0x0 +phy_chain_tx_polarity_flip_physical{20.0}=0x1 +phy_chain_rx_polarity_flip_physical{20.0}=0x1 + +#wc5 P/N flip +phy_chain_tx_polarity_flip_physical{21.0}=0x0 +phy_chain_rx_polarity_flip_physical{21.0}=0x0 +phy_chain_tx_polarity_flip_physical{22.0}=0x1 +phy_chain_rx_polarity_flip_physical{22.0}=0x1 +phy_chain_tx_polarity_flip_physical{23.0}=0x0 +phy_chain_rx_polarity_flip_physical{23.0}=0x1 +phy_chain_tx_polarity_flip_physical{24.0}=0x1 +phy_chain_rx_polarity_flip_physical{24.0}=0x1 + +#wc6 P/N flip +phy_chain_tx_polarity_flip_physical{25.0}=0x0 +phy_chain_rx_polarity_flip_physical{25.0}=0x1 +phy_chain_tx_polarity_flip_physical{26.0}=0x1 +phy_chain_rx_polarity_flip_physical{26.0}=0x0 +phy_chain_tx_polarity_flip_physical{27.0}=0x0 +phy_chain_rx_polarity_flip_physical{27.0}=0x1 +phy_chain_tx_polarity_flip_physical{28.0}=0x1 +phy_chain_rx_polarity_flip_physical{28.0}=0x0 + +#wc7 P/N flip +phy_chain_tx_polarity_flip_physical{29.0}=0x1 +phy_chain_rx_polarity_flip_physical{29.0}=0x1 +phy_chain_tx_polarity_flip_physical{30.0}=0x1 +phy_chain_rx_polarity_flip_physical{30.0}=0x0 +phy_chain_tx_polarity_flip_physical{31.0}=0x0 +phy_chain_rx_polarity_flip_physical{31.0}=0x0 +phy_chain_tx_polarity_flip_physical{32.0}=0x0 +phy_chain_rx_polarity_flip_physical{32.0}=0x0 + +#wc8 P/N flip +phy_chain_tx_polarity_flip_physical{33.0}=0x1 +phy_chain_rx_polarity_flip_physical{33.0}=0x1 +phy_chain_tx_polarity_flip_physical{34.0}=0x0 +phy_chain_rx_polarity_flip_physical{34.0}=0x0 +phy_chain_tx_polarity_flip_physical{35.0}=0x0 +phy_chain_rx_polarity_flip_physical{35.0}=0x0 +phy_chain_tx_polarity_flip_physical{36.0}=0x1 +phy_chain_rx_polarity_flip_physical{36.0}=0x0 + +#wc9 P/N flip +phy_chain_tx_polarity_flip_physical{37.0}=0x1 +phy_chain_rx_polarity_flip_physical{37.0}=0x1 +phy_chain_tx_polarity_flip_physical{38.0}=0x1 +phy_chain_rx_polarity_flip_physical{38.0}=0x0 +phy_chain_tx_polarity_flip_physical{39.0}=0x1 +phy_chain_rx_polarity_flip_physical{39.0}=0x0 +phy_chain_tx_polarity_flip_physical{40.0}=0x0 +phy_chain_rx_polarity_flip_physical{40.0}=0x1 + +#wc10 P/N flip +phy_chain_tx_polarity_flip_physical{41.0}=0x1 +phy_chain_rx_polarity_flip_physical{41.0}=0x1 +phy_chain_tx_polarity_flip_physical{42.0}=0x0 +phy_chain_rx_polarity_flip_physical{42.0}=0x1 +phy_chain_tx_polarity_flip_physical{43.0}=0x1 +phy_chain_rx_polarity_flip_physical{43.0}=0x0 +phy_chain_tx_polarity_flip_physical{44.0}=0x1 +phy_chain_rx_polarity_flip_physical{44.0}=0x1 + +#wc11 P/N flip +phy_chain_tx_polarity_flip_physical{45.0}=0x1 +phy_chain_rx_polarity_flip_physical{45.0}=0x0 +phy_chain_tx_polarity_flip_physical{46.0}=0x1 +phy_chain_rx_polarity_flip_physical{46.0}=0x0 +phy_chain_tx_polarity_flip_physical{47.0}=0x1 +phy_chain_rx_polarity_flip_physical{47.0}=0x1 +phy_chain_tx_polarity_flip_physical{48.0}=0x0 +phy_chain_rx_polarity_flip_physical{48.0}=0x1 + +#wc12 P/N flip +phy_chain_tx_polarity_flip_physical{49.0}=0x1 +phy_chain_rx_polarity_flip_physical{49.0}=0x0 +phy_chain_tx_polarity_flip_physical{50.0}=0x1 +phy_chain_rx_polarity_flip_physical{50.0}=0x0 +phy_chain_tx_polarity_flip_physical{51.0}=0x0 +phy_chain_rx_polarity_flip_physical{51.0}=0x1 +phy_chain_tx_polarity_flip_physical{52.0}=0x1 +phy_chain_rx_polarity_flip_physical{52.0}=0x1 + +#wc13 P/N flip +phy_chain_tx_polarity_flip_physical{53.0}=0x0 +phy_chain_rx_polarity_flip_physical{53.0}=0x0 +phy_chain_tx_polarity_flip_physical{54.0}=0x1 +phy_chain_rx_polarity_flip_physical{54.0}=0x1 +phy_chain_tx_polarity_flip_physical{55.0}=0x0 +phy_chain_rx_polarity_flip_physical{55.0}=0x1 +phy_chain_tx_polarity_flip_physical{56.0}=0x1 +phy_chain_rx_polarity_flip_physical{56.0}=0x1 + +#wc14 P/N flip +phy_chain_tx_polarity_flip_physical{57.0}=0x1 +phy_chain_rx_polarity_flip_physical{57.0}=0x0 +phy_chain_tx_polarity_flip_physical{58.0}=0x1 +phy_chain_rx_polarity_flip_physical{58.0}=0x1 +phy_chain_tx_polarity_flip_physical{59.0}=0x0 +phy_chain_rx_polarity_flip_physical{59.0}=0x0 +phy_chain_tx_polarity_flip_physical{60.0}=0x1 +phy_chain_rx_polarity_flip_physical{60.0}=0x1 + +#wc15 P/N flip +phy_chain_tx_polarity_flip_physical{61.0}=0x0 +phy_chain_rx_polarity_flip_physical{61.0}=0x1 +phy_chain_tx_polarity_flip_physical{62.0}=0x1 +phy_chain_rx_polarity_flip_physical{62.0}=0x0 +phy_chain_tx_polarity_flip_physical{63.0}=0x0 +phy_chain_rx_polarity_flip_physical{63.0}=0x1 +phy_chain_tx_polarity_flip_physical{64.0}=0x0 +phy_chain_rx_polarity_flip_physical{64.0}=0x0 + +#wc16 P/N flip +phy_chain_tx_polarity_flip_physical{65.0}=0x1 +phy_chain_rx_polarity_flip_physical{65.0}=0x0 +phy_chain_tx_polarity_flip_physical{66.0}=0x0 +phy_chain_rx_polarity_flip_physical{66.0}=0x0 +phy_chain_tx_polarity_flip_physical{67.0}=0x1 +phy_chain_rx_polarity_flip_physical{67.0}=0x1 +phy_chain_tx_polarity_flip_physical{68.0}=0x0 +phy_chain_rx_polarity_flip_physical{68.0}=0x0 + +#wc17 P/N flip +phy_chain_tx_polarity_flip_physical{69.0}=0x1 +phy_chain_rx_polarity_flip_physical{69.0}=0x1 +phy_chain_tx_polarity_flip_physical{70.0}=0x0 +phy_chain_rx_polarity_flip_physical{70.0}=0x0 +phy_chain_tx_polarity_flip_physical{71.0}=0x1 +phy_chain_rx_polarity_flip_physical{71.0}=0x0 +phy_chain_tx_polarity_flip_physical{72.0}=0x0 +phy_chain_rx_polarity_flip_physical{72.0}=0x0 + +#wc18 P/N flip +phy_chain_tx_polarity_flip_physical{73.0}=0x0 +phy_chain_rx_polarity_flip_physical{73.0}=0x1 +phy_chain_tx_polarity_flip_physical{74.0}=0x1 +phy_chain_rx_polarity_flip_physical{74.0}=0x0 +phy_chain_tx_polarity_flip_physical{75.0}=0x0 +phy_chain_rx_polarity_flip_physical{75.0}=0x1 +phy_chain_tx_polarity_flip_physical{76.0}=0x1 +phy_chain_rx_polarity_flip_physical{76.0}=0x0 + +#wc19 P/N flip +phy_chain_tx_polarity_flip_physical{77.0}=0x0 +phy_chain_rx_polarity_flip_physical{77.0}=0x0 +phy_chain_tx_polarity_flip_physical{78.0}=0x0 +phy_chain_rx_polarity_flip_physical{78.0}=0x0 +phy_chain_tx_polarity_flip_physical{79.0}=0x1 +phy_chain_rx_polarity_flip_physical{79.0}=0x1 +phy_chain_tx_polarity_flip_physical{80.0}=0x1 +phy_chain_rx_polarity_flip_physical{80.0}=0x1 + +#wc20 P/N flip +phy_chain_tx_polarity_flip_physical{81.0}=0x0 +phy_chain_rx_polarity_flip_physical{81.0}=0x0 +phy_chain_tx_polarity_flip_physical{82.0}=0x0 +phy_chain_rx_polarity_flip_physical{82.0}=0x0 +phy_chain_tx_polarity_flip_physical{83.0}=0x1 +phy_chain_rx_polarity_flip_physical{83.0}=0x1 +phy_chain_tx_polarity_flip_physical{84.0}=0x1 +phy_chain_rx_polarity_flip_physical{84.0}=0x0 + +#wc21 P/N flip +phy_chain_tx_polarity_flip_physical{85.0}=0x1 +phy_chain_rx_polarity_flip_physical{85.0}=0x1 +phy_chain_tx_polarity_flip_physical{86.0}=0x0 +phy_chain_rx_polarity_flip_physical{86.0}=0x1 +phy_chain_tx_polarity_flip_physical{87.0}=0x1 +phy_chain_rx_polarity_flip_physical{87.0}=0x0 +phy_chain_tx_polarity_flip_physical{88.0}=0x0 +phy_chain_rx_polarity_flip_physical{88.0}=0x0 + +#wc22 P/N flip +phy_chain_tx_polarity_flip_physical{89.0}=0x1 +phy_chain_rx_polarity_flip_physical{89.0}=0x0 +phy_chain_tx_polarity_flip_physical{90.0}=0x0 +phy_chain_rx_polarity_flip_physical{90.0}=0x0 +phy_chain_tx_polarity_flip_physical{91.0}=0x1 +phy_chain_rx_polarity_flip_physical{91.0}=0x1 +phy_chain_tx_polarity_flip_physical{92.0}=0x0 +phy_chain_rx_polarity_flip_physical{92.0}=0x1 + +#wc23 P/N flip +phy_chain_tx_polarity_flip_physical{93.0}=0x1 +phy_chain_rx_polarity_flip_physical{93.0}=0x1 +phy_chain_tx_polarity_flip_physical{94.0}=0x1 +phy_chain_rx_polarity_flip_physical{94.0}=0x1 +phy_chain_tx_polarity_flip_physical{95.0}=0x0 +phy_chain_rx_polarity_flip_physical{95.0}=0x0 +phy_chain_tx_polarity_flip_physical{96.0}=0x0 +phy_chain_rx_polarity_flip_physical{96.0}=0x1 + +#wc24 P/N flip +phy_chain_tx_polarity_flip_physical{97.0}=0x1 +phy_chain_rx_polarity_flip_physical{97.0}=0x1 +phy_chain_tx_polarity_flip_physical{98.0}=0x0 +phy_chain_rx_polarity_flip_physical{98.0}=0x0 +phy_chain_tx_polarity_flip_physical{99.0}=0x1 +phy_chain_rx_polarity_flip_physical{99.0}=0x1 +phy_chain_tx_polarity_flip_physical{100.0}=0x0 +phy_chain_rx_polarity_flip_physical{100.0}=0x0 + +#wc25 P/N flip +phy_chain_tx_polarity_flip_physical{101.0}=0x1 +phy_chain_rx_polarity_flip_physical{101.0}=0x0 +phy_chain_tx_polarity_flip_physical{102.0}=0x0 +phy_chain_rx_polarity_flip_physical{102.0}=0x1 +phy_chain_tx_polarity_flip_physical{103.0}=0x1 +phy_chain_rx_polarity_flip_physical{103.0}=0x0 +phy_chain_tx_polarity_flip_physical{104.0}=0x0 +phy_chain_rx_polarity_flip_physical{104.0}=0x0 + +#wc26 P/N flip +phy_chain_tx_polarity_flip_physical{105.0}=0x1 +phy_chain_rx_polarity_flip_physical{105.0}=0x0 +phy_chain_tx_polarity_flip_physical{106.0}=0x0 +phy_chain_rx_polarity_flip_physical{106.0}=0x1 +phy_chain_tx_polarity_flip_physical{107.0}=0x1 +phy_chain_rx_polarity_flip_physical{107.0}=0x0 +phy_chain_tx_polarity_flip_physical{108.0}=0x0 +phy_chain_rx_polarity_flip_physical{108.0}=0x1 + +#wc27 P/N flip +phy_chain_tx_polarity_flip_physical{109.0}=0x1 +phy_chain_rx_polarity_flip_physical{109.0}=0x1 +phy_chain_tx_polarity_flip_physical{110.0}=0x0 +phy_chain_rx_polarity_flip_physical{110.0}=0x0 +phy_chain_tx_polarity_flip_physical{111.0}=0x1 +phy_chain_rx_polarity_flip_physical{111.0}=0x1 +phy_chain_tx_polarity_flip_physical{112.0}=0x0 +phy_chain_rx_polarity_flip_physical{112.0}=0x0 + +#wc28 P/N flip +phy_chain_tx_polarity_flip_physical{113.0}=0x1 +phy_chain_rx_polarity_flip_physical{113.0}=0x1 +phy_chain_tx_polarity_flip_physical{114.0}=0x0 +phy_chain_rx_polarity_flip_physical{114.0}=0x0 +phy_chain_tx_polarity_flip_physical{115.0}=0x1 +phy_chain_rx_polarity_flip_physical{115.0}=0x0 +phy_chain_tx_polarity_flip_physical{116.0}=0x0 +phy_chain_rx_polarity_flip_physical{116.0}=0x0 + +#wc29 P/N flip +phy_chain_tx_polarity_flip_physical{117.0}=0x1 +phy_chain_rx_polarity_flip_physical{117.0}=0x1 +phy_chain_tx_polarity_flip_physical{118.0}=0x0 +phy_chain_rx_polarity_flip_physical{118.0}=0x0 +phy_chain_tx_polarity_flip_physical{119.0}=0x1 +phy_chain_rx_polarity_flip_physical{119.0}=0x1 +phy_chain_tx_polarity_flip_physical{120.0}=0x0 +phy_chain_rx_polarity_flip_physical{120.0}=0x0 + +#wc30 P/N flip +phy_chain_tx_polarity_flip_physical{121.0}=0x1 +phy_chain_rx_polarity_flip_physical{121.0}=0x0 +phy_chain_tx_polarity_flip_physical{122.0}=0x0 +phy_chain_rx_polarity_flip_physical{122.0}=0x1 +phy_chain_tx_polarity_flip_physical{123.0}=0x1 +phy_chain_rx_polarity_flip_physical{123.0}=0x0 +phy_chain_tx_polarity_flip_physical{124.0}=0x0 +phy_chain_rx_polarity_flip_physical{124.0}=0x1 + +#wc31 P/N flip +phy_chain_tx_polarity_flip_physical{125.0}=0x1 +phy_chain_rx_polarity_flip_physical{125.0}=0x1 +phy_chain_tx_polarity_flip_physical{126.0}=0x0 +phy_chain_rx_polarity_flip_physical{126.0}=0x0 +phy_chain_tx_polarity_flip_physical{127.0}=0x1 +phy_chain_rx_polarity_flip_physical{127.0}=0x1 +phy_chain_tx_polarity_flip_physical{128.0}=0x0 +phy_chain_rx_polarity_flip_physical{128.0}=0x0 + +#MC P/N flip +phy_chain_tx_polarity_flip_physical{129.0}=0x0 +phy_chain_rx_polarity_flip_physical{129.0}=0x0 +phy_chain_tx_polarity_flip_physical{130.0}=0x0 +phy_chain_rx_polarity_flip_physical{130.0}=0x0 +phy_chain_tx_polarity_flip_physical{131.0}=0x0 +phy_chain_rx_polarity_flip_physical{131.0}=0x0 +phy_chain_tx_polarity_flip_physical{132.0}=0x0 +phy_chain_rx_polarity_flip_physical{132.0}=0x0 + +dport_map_port_1=1 +dport_map_port_5=2 +dport_map_port_9=3 +dport_map_port_13=4 +dport_map_port_17=5 +dport_map_port_21=6 +dport_map_port_25=7 +dport_map_port_29=8 +dport_map_port_33=9 +dport_map_port_37=10 +dport_map_port_41=11 +dport_map_port_45=12 +dport_map_port_49=13 +dport_map_port_53=14 +dport_map_port_57=15 +dport_map_port_61=16 +dport_map_port_67=17 +dport_map_port_71=18 +dport_map_port_75=19 +dport_map_port_79=20 +dport_map_port_83=21 +dport_map_port_87=22 +dport_map_port_91=23 +dport_map_port_95=24 +dport_map_port_99=25 +dport_map_port_103=26 +dport_map_port_107=27 +dport_map_port_111=28 +dport_map_port_115=29 +dport_map_port_119=30 +dport_map_port_123=31 +dport_map_port_127=32 +dport_map_port_66=33 +dport_map_port_130=34 + +# configuration for 100G optical module +serdes_preemphasis_1=0x164608 +serdes_preemphasis_5=0x164608 +serdes_preemphasis_9=0x164608 +serdes_preemphasis_13=0x134908 +serdes_preemphasis_17=0x134908 +serdes_preemphasis_21=0x134908 +serdes_preemphasis_25=0x124a08 +serdes_preemphasis_29=0x124a08 +serdes_preemphasis_33=0x114b08 +serdes_preemphasis_37=0x114b08 +serdes_preemphasis_41=0x0f4d08 +serdes_preemphasis_45=0x0f4d08 +serdes_preemphasis_49=0x0d4f08 +serdes_preemphasis_53=0x0d4f08 +serdes_preemphasis_57=0x0d4f08 +serdes_preemphasis_61=0x0d4f08 +serdes_preemphasis_67=0x0d4f08 +serdes_preemphasis_71=0x0d4f08 +serdes_preemphasis_75=0x0d4f08 +serdes_preemphasis_79=0x0d4f08 +serdes_preemphasis_83=0x0d4f08 +serdes_preemphasis_87=0x0f4d08 +serdes_preemphasis_91=0x0f4d08 +serdes_preemphasis_95=0x0f4d08 +serdes_preemphasis_99=0x114b08 +serdes_preemphasis_103=0x114b08 +serdes_preemphasis_107=0x114b08 +serdes_preemphasis_111=0x124a08 +serdes_preemphasis_115=0x134908 +serdes_preemphasis_119=0x134908 +serdes_preemphasis_123=0x134908 +serdes_preemphasis_127=0x164608 + +reglist_enable=1 +scache_filename=/tmp/scache +schan_intr_enable=0 +stable_size=0x5500000 +tdma_timeout_usec=3000000 diff --git a/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/AS13-48F8H/port_config.ini b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/AS13-48F8H/port_config.ini new file mode 100644 index 000000000000..9e4fd2d930c6 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/AS13-48F8H/port_config.ini @@ -0,0 +1,57 @@ +# name lanes alias index +Ethernet1 49 SFP1 1 +Ethernet2 50 SFP2 2 +Ethernet3 51 SFP3 3 +Ethernet4 52 SFP4 4 +Ethernet5 13 SFP5 5 +Ethernet6 14 SFP6 6 +Ethernet7 15 SFP7 7 +Ethernet8 16 SFP8 8 +Ethernet9 21 SFP9 9 +Ethernet10 22 SFP10 10 +Ethernet11 23 SFP11 11 +Ethernet12 24 SFP12 12 +Ethernet13 29 SFP13 13 +Ethernet14 30 SFP14 14 +Ethernet15 31 SFP15 15 +Ethernet16 32 SFP16 16 +Ethernet17 33 SFP17 17 +Ethernet18 34 SFP18 18 +Ethernet19 35 SFP19 19 +Ethernet20 36 SFP20 20 +Ethernet21 41 SFP21 21 +Ethernet22 42 SFP22 22 +Ethernet23 43 SFP23 23 +Ethernet24 44 SFP24 24 +Ethernet25 1 SFP25 25 +Ethernet26 2 SFP26 26 +Ethernet27 3 SFP27 27 +Ethernet28 4 SFP28 28 +Ethernet29 5 SFP29 29 +Ethernet30 6 SFP30 30 +Ethernet31 7 SFP31 31 +Ethernet32 8 SFP32 32 +Ethernet33 85 SFP33 33 +Ethernet34 86 SFP34 34 +Ethernet35 87 SFP35 35 +Ethernet36 88 SFP36 36 +Ethernet37 93 SFP37 37 +Ethernet38 94 SFP38 38 +Ethernet39 95 SFP39 39 +Ethernet40 96 SFP40 40 +Ethernet41 97 SFP41 41 +Ethernet42 98 SFP42 42 +Ethernet43 99 SFP43 43 +Ethernet44 100 SFP44 44 +Ethernet45 105 SFP45 45 +Ethernet46 106 SFP46 46 +Ethernet47 107 SFP47 47 +Ethernet48 108 SFP48 48 +Ethernet49 57,58,59,60 QSFP1 49 +Ethernet50 61,62,63,64 QSFP2 50 +Ethernet51 121,122,123,124 QSFP3 51 +Ethernet52 113,114,115,116 QSFP4 52 +Ethernet53 125,126,127,128 QSFP5 53 +Ethernet54 65,66,67,68 QSFP6 54 +Ethernet55 77,78,79,80 QSFP7 55 +Ethernet56 69,70,71,72 QSFP8 56 diff --git a/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/AS13-48F8H/sai.profile b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/AS13-48F8H/sai.profile new file mode 100644 index 000000000000..c5b2d655b037 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/AS13-48F8H/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/platform/td3-as13-48f8h.config.bcm diff --git a/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/custom_led.bin b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/custom_led.bin new file mode 100644 index 000000000000..b2ed8cb8d090 Binary files /dev/null and b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/custom_led.bin differ diff --git a/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/default_sku b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/default_sku new file mode 100644 index 000000000000..6933928c3bdb --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/default_sku @@ -0,0 +1 @@ +AS13-48F8H t1 \ No newline at end of file diff --git a/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/installer.conf b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/installer.conf new file mode 100644 index 000000000000..dc3cf67d19e7 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/installer.conf @@ -0,0 +1,2 @@ +CONSOLE_SPEED=9600 +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="processor.max_cstate=1 intel_idle.max_cstate=0" diff --git a/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/led_proc_init.soc b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/led_proc_init.soc new file mode 100644 index 000000000000..28cd4b9bc9f7 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/led_proc_init.soc @@ -0,0 +1,9 @@ +#Enable all ports +#port all en=1 +#sleep 6 +#linkscan 250000; port xe,ce linkscan=on + +#Load LED +#led auto on; led start + + diff --git a/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/linkscan_led_fw.bin b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/linkscan_led_fw.bin new file mode 100644 index 000000000000..a6a4794ecc2b Binary files /dev/null and b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/linkscan_led_fw.bin differ diff --git a/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/minigraph.xml b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/minigraph.xml new file mode 100644 index 000000000000..527255843b74 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/minigraph.xml @@ -0,0 +1,974 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + sonic + 10.0.0.32 + 1 + 180 + 60 + + + sonic + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + sonic + 10.0.0.34 + 1 + 180 + 60 + + + sonic + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + sonic + 10.0.0.36 + 1 + 180 + 60 + + + sonic + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + sonic + 10.0.0.38 + 1 + 180 + 60 + + + sonic + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + sonic + 10.0.0.40 + 1 + 180 + 60 + + + sonic + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + sonic + 10.0.0.42 + 1 + 180 + 60 + + + sonic + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + sonic + 10.0.0.44 + 1 + 180 + 60 + + + sonic + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + sonic + 10.0.0.46 + 1 + 180 + 60 + + + sonic + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + sonic + 10.0.0.48 + 1 + 180 + 60 + + + sonic + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + sonic + 10.0.0.50 + 1 + 180 + 60 + + + sonic + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + sonic + 10.0.0.52 + 1 + 180 + 60 + + + sonic + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + sonic + 10.0.0.54 + 1 + 180 + 60 + + + sonic + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + sonic + 10.0.0.56 + 1 + 180 + 60 + + + sonic + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + sonic + 10.0.0.58 + 1 + 180 + 60 + + + sonic + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + sonic + 10.0.0.60 + 1 + 180 + 60 + + + sonic + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + sonic + 10.0.0.62 + 1 + 180 + 60 + + + sonic + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + sonic + + +
10.0.0.33
+ + +
+ +
10.0.0.1
+ + +
+ +
10.0.0.35
+ + +
+ +
10.0.0.3
+ + +
+ +
10.0.0.37
+ + +
+ +
10.0.0.5
+ + +
+ +
10.0.0.39
+ + +
+ +
10.0.0.7
+ + +
+ +
10.0.0.41
+ + +
+ +
10.0.0.9
+ + +
+ +
10.0.0.43
+ + +
+ +
10.0.0.11
+ + +
+ +
10.0.0.45
+ + +
+ +
10.0.0.13
+ + +
+ +
10.0.0.47
+ + +
+ +
10.0.0.15
+ + +
+ +
10.0.0.49
+ + +
+ +
10.0.0.17
+ + +
+ +
10.0.0.51
+ + +
+ +
10.0.0.19
+ + +
+ +
10.0.0.53
+ + +
+ +
10.0.0.21
+ + +
+ +
10.0.0.55
+ + +
+ +
10.0.0.23
+ + +
+ +
10.0.0.57
+ + +
+ +
10.0.0.25
+ + +
+ +
10.0.0.59
+ + +
+ +
10.0.0.27
+ + +
+ +
10.0.0.61
+ + +
+ +
10.0.0.29
+ + +
+ +
10.0.0.63
+ + +
+ +
10.0.0.31
+ + +
+
+ +
+ + 64001 + ARISTA01T0 + + + + 65200 + ARISTA01T2 + + + + 64002 + ARISTA02T0 + + + + 65200 + ARISTA02T2 + + + + 64003 + ARISTA03T0 + + + + 65200 + ARISTA03T2 + + + + 64004 + ARISTA04T0 + + + + 65200 + ARISTA04T2 + + + + 64005 + ARISTA05T0 + + + + 65200 + ARISTA05T2 + + + + 64006 + ARISTA06T0 + + + + 65200 + ARISTA06T2 + + + + 64007 + ARISTA07T0 + + + + 65200 + ARISTA07T2 + + + + 64008 + ARISTA08T0 + + + + 65200 + ARISTA08T2 + + + + 64009 + ARISTA09T0 + + + + 65200 + ARISTA09T2 + + + + 64010 + ARISTA10T0 + + + + 65200 + ARISTA10T2 + + + + 64011 + ARISTA11T0 + + + + 65200 + ARISTA11T2 + + + + 64012 + ARISTA12T0 + + + + 65200 + ARISTA12T2 + + + + 64013 + ARISTA13T0 + + + + 65200 + ARISTA13T2 + + + + 64014 + ARISTA14T0 + + + + 65200 + ARISTA14T2 + + + + 64015 + ARISTA15T0 + + + + 65200 + ARISTA15T2 + + + + 64016 + ARISTA16T0 + + + + 65200 + ARISTA16T2 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + + + + + + sonic + + + + + + SFP1 + 10.0.0.0/31 + + + + SFP2 + 10.0.0.2/31 + + + + SFP3 + 10.0.0.4/31 + + + + SFP4 + 10.0.0.6/31 + + + + SFP5 + 10.0.0.8/31 + + + + SFP6 + 10.0.0.10/31 + + + + SFP7 + 10.0.0.12/31 + + + + SFP8 + 10.0.0.14/31 + + + + SFP9 + 10.0.0.16/31 + + + + SFP10 + 10.0.0.18/31 + + + + SFP11 + 10.0.0.20/31 + + + + SFP12 + 10.0.0.22/31 + + + + SFP13 + 10.0.0.24/31 + + + + SFP14 + 10.0.0.26/31 + + + + SFP15 + 10.0.0.28/31 + + + + SFP16 + 10.0.0.30/31 + + + + SFP17 + 10.0.0.32/31 + + + + SFP18 + 10.0.0.34/31 + + + + SFP19 + 10.0.0.36/31 + + + + SFP20 + 10.0.0.38/31 + + + + SFP21 + 10.0.0.40/31 + + + + SFP22 + 10.0.0.42/31 + + + + SFP23 + 10.0.0.44/31 + + + + SFP24 + 10.0.0.46/31 + + + + SFP25 + 10.0.0.48/31 + + + + SFP26 + 10.0.0.50/31 + + + + SFP27 + 10.0.0.52/31 + + + + SFP28 + 10.0.0.54/31 + + + + SFP29 + 10.0.0.56/31 + + + + SFP30 + 10.0.0.58/31 + + + + SFP31 + 10.0.0.60/31 + + + + SFP32 + 10.0.0.62/31 + + + + SFP33 + 10.0.0.64/31 + + + + SFP34 + 10.0.0.66/31 + + + + SFP35 + 10.0.0.68/31 + + + + SFP36 + 10.0.0.70/31 + + + + SFP37 + 10.0.0.72/31 + + + + SFP38 + 10.0.0.74/31 + + + + SFP39 + 10.0.0.76/31 + + + + SFP40 + 10.0.0.78/31 + + + + SFP41 + 10.0.0.80/31 + + + + SFP42 + 10.0.0.82/31 + + + + SFP43 + 10.0.0.84/31 + + + + SFP44 + 10.0.0.86/31 + + + + SFP45 + 10.0.0.88/31 + + + + SFP46 + 10.0.0.90/31 + + + + SFP47 + 10.0.0.92/31 + + + + SFP48 + 10.0.0.94/31 + + + + QSFP1 + 10.0.0.96/31 + + + + QSFP2 + 10.0.0.98/31 + + + + QSFP3 + 10.0.0.100/31 + + + + QSFP4 + 10.0.0.102/31 + + + + QSFP5 + 10.0.0.104/31 + + + + QSFP6 + 10.0.0.106/31 + + + + QSFP7 + 10.0.0.108/31 + + + + QSFP8 + 10.0.0.110/31 + + + + + + + + + + + + + sonic + AS13-48F8H + + + + + + + sonic + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + ErspanDestinationIpv4 + + 2.2.2.2 + + + + + + + sonic + AS13-48F8H +
diff --git a/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/opennsl-postinit.cfg b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/opennsl-postinit.cfg new file mode 100644 index 000000000000..7008c14c0ffc --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/opennsl-postinit.cfg @@ -0,0 +1,3 @@ +linkscan 250000; port xe,ce linkscan=on +sleep 1 +led auto on; led start diff --git a/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/cputemputil.py b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/cputemputil.py new file mode 100644 index 000000000000..b5af46115b5c --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/cputemputil.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python + +# +# cputemputil.py +# +# Platform-specific CPU temperature Interface for SONiC +# + +__author__ = 'Wirut G.' +__license__ = "GPL" +__version__ = "0.1.0" +__status__ = "Development" + +import subprocess +import requests + +class CpuTempUtil(): + """Platform-specific CpuTempUtil class""" + + def __init__(self): + pass + + + def get_cpu_temp(self): + + # Get list of temperature of CPU cores. + p = subprocess.Popen(['sensors', '-Au', 'coretemp-isa-0000'], stdout=subprocess.PIPE,stderr=subprocess.PIPE) + out, err = p.communicate() + raw_data_list = out.splitlines() + temp_string_list = [i for i, s in enumerate(raw_data_list) if '_input' in s] + tmp_list = [0] + + for temp_string in temp_string_list: + tmp_list.append(float(raw_data_list[temp_string].split(":")[1])) + + return tmp_list + + + def get_max_cpu_tmp(self): + # Get maximum temperature from list of temperature of CPU cores. + return max(self.get_cpu_temp()) diff --git a/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/eeprom.py b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/eeprom.py new file mode 100644 index 000000000000..9f42b56ce7c2 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/eeprom.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +############################################################################# +# Celestica DX010 +# +# 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, e: + raise ImportError (str(e) + "- required module not found") + + +class board(eeprom_tlvinfo.TlvInfoDecoder): + + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/class/i2c-adapter/i2c-0/0-0056/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) + diff --git a/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/fanutil.py b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/fanutil.py new file mode 100644 index 000000000000..dab2f64dd5e0 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/fanutil.py @@ -0,0 +1,310 @@ +#!/usr/bin/env python + +__author__ = 'Wirut G.' +__license__ = "GPL" +__version__ = "0.1.2" +__status__ = "Development" + +import requests +import re + + +class FanUtil(): + """Platform-specific FanUtil class""" + + def __init__(self): + + self.fan_fru_url = "http://240.1.1.1:8080/api/sys/fruid/fan" + self.sensor_url = "http://240.1.1.1:8080/api/sys/sensors" + self.fru_data_list = None + self.sensor_data_list = None + + def request_data(self): + # Reqest data from BMC if not exist. + if self.fru_data_list is None or self.sensor_data_list is None: + fru_data_req = requests.get(self.fan_fru_url) + sensor_data_req = requests.get(self.sensor_url) + fru_json = fru_data_req.json() + sensor_json = sensor_data_req.json() + self.fru_data_list = fru_json.get('Information') + self.sensor_data_list = sensor_json.get('Information') + return self.fru_data_list, self.sensor_data_list + + def name_to_index(self, fan_name): + # Get fan index from fan name + match = re.match(r"(FAN)([0-9]+)-(1|2)", fan_name, re.I) + fan_index = None + if match: + i_list = list(match.groups()) + fan_index = int(i_list[1])*2 - (int(i_list[2]) % 2) + return fan_index + + def get_num_fans(self): + """ + Get the number of fans + :return: int num_fans + """ + num_fans = 8 + + return num_fans + + def get_fan_speed(self, fan_name): + """ + Get the current speed of the fan, the unit is "RPM" + :return: int fan_speed + """ + + try: + # Get real fan index + index = self.name_to_index(fan_name) + + # Set key and index. + fan_speed = 0 + position_key = "Front" if index % 2 != 0 else "Rear" + index = int(round(float(index)/2)) + fan_key = "Fan " + str(index) + " " + position_key + + # Request and validate fan information. + self.fru_data_list, self.sensor_data_list = self.request_data() + + # Get fan's speed. + for sensor_data in self.sensor_data_list: + sensor_name = sensor_data.get('name') + if "fan" in str(sensor_name): + fan_data = sensor_data.get(fan_key) + fan_sp_list = map(int, re.findall(r'\d+', fan_data)) + fan_speed = fan_sp_list[0] + + except: + return 0 + + return fan_speed + + def get_fan_low_threshold(self, fan_name): + """ + Get the low speed threshold of the fan. + if the current speed < low speed threshold, + the status of the fan is not ok. + :return: int fan_low_threshold + """ + + try: + # Get real fan index + index = self.name_to_index(fan_name) + + # Set key and index. + fan_low_threshold = 0 + position_key = "Front" if index % 2 != 0 else "Rear" + index = int(round(float(index)/2)) + fan_key = "Fan " + str(index) + " " + position_key + + # Request and validate fan information. + self.fru_data_list, self.sensor_data_list = self.request_data() + + # Get fan's threshold. + for sensor_data in self.sensor_data_list: + sensor_name = sensor_data.get('name') + if "fan" in str(sensor_name): + fan_data = sensor_data.get(fan_key) + fan_sp_list = map(int, re.findall(r'\d+', fan_data)) + fan_low_threshold = fan_sp_list[1] + + except: + return "N/A" + + return fan_low_threshold + + def get_fan_high_threshold(self, fan_name): + """ + Get the hight speed threshold of the fan, + if the current speed > high speed threshold, + the status of the fan is not ok + :return: int fan_high_threshold + """ + + try: + # Get real fan index + index = self.name_to_index(fan_name) + + # Set key and index. + fan_high_threshold = 0 + position_key = "Front" if index % 2 != 0 else "Rear" + index = int(round(float(index)/2)) + fan_key = "Fan " + str(index) + " " + position_key + + # Request and validate fan information. + self.fru_data_list, self.sensor_data_list = self.request_data() + + # Get fan's threshold. + for sensor_data in self.sensor_data_list: + sensor_name = sensor_data.get('name') + if "fan" in str(sensor_name): + fan_data = sensor_data.get(fan_key) + fan_sp_list = map(int, re.findall(r'\d+', fan_data)) + fan_high_threshold = fan_sp_list[2] + + except: + return 0 + + return fan_high_threshold + + def get_fan_pn(self, fan_name): + """ + Get the product name of the fan + :return: str fan_pn + """ + + try: + # Get real fan index + index = self.name_to_index(fan_name) + + # Set key and index. + fan_pn = "N/A" + index = int(round(float(index)/2)) + fan_fru_key = "Fantray" + str(index) + + # Request and validate fan information. + self.fru_data_list, self.sensor_data_list = self.request_data() + + # Get fan's fru. + for fan_fru in self.fru_data_list: + matching_fan = [s for s in fan_fru if fan_fru_key in s] + if matching_fan: + pn = [s for s in fan_fru if "Part" in s] + fan_pn = pn[0].split()[4] + + except: + return "N/A" + + return fan_pn + + def get_fan_sn(self, fan_name): + """ + Get the serial number of the fan + :return: str fan_sn + """ + try: + # Get real fan index + index = self.name_to_index(fan_name) + + # Set key and index. + fan_sn = "N/A" + index = int(round(float(index)/2)) + fan_fru_key = "Fantray" + str(index) + + # Request and validate fan information. + self.fru_data_list, self.sensor_data_list = self.request_data() + + # Get fan's fru. + for fan_fru in self.fru_data_list: + matching_fan = [s for s in fan_fru if fan_fru_key in s] + if matching_fan: + serial = [s for s in fan_fru if "Serial" in s] + fan_sn = serial[0].split()[3] + + except: + return "N/A" + + return fan_sn + + def get_fans_name_list(self): + """ + Get list of fan name. + :return: list fan_names + """ + fan_names = [] + + # Get the number of fans + n_fan = self.get_num_fans() + + # Set fan name and add to the list. + for x in range(1, n_fan + 1): + f_index = int(round(float(x)/2)) + pos = 1 if x % 2 else 2 + fan_name = 'FAN{}_{}'.format(f_index, pos) + fan_names.append(fan_name) + + return fan_names + + def get_all(self): + """ + Get all information of system FANs, returns JSON objects in python 'DICT'. + Number, mandatory, max number of FAN, integer + FAN1_1, FAN1_2, ... mandatory, FAN name, string + Present, mandatory for each FAN, present status, boolean, True for present, False for NOT present, read directly from h/w + Running, conditional, if PRESENT is True, running status of the FAN, True for running, False for stopped, read directly from h/w + Speed, conditional, if PRESENT is True, real FAN speed, float, read directly from h/w + LowThd, conditional, if PRESENT is True, lower bound of FAN speed, float, read from h/w + HighThd, conditional, if PRESENT is True, upper bound of FAN speed, float, read from h/w + PN, conditional, if PRESENT is True, PN of the FAN, string + SN, conditional, if PRESENT is True, SN of the FAN, string) + """ + + self.fru_data_list, self.sensor_data_list = self.request_data() + all_fan_dict = dict() + + # Get the number of fans + n_fan = self.get_num_fans() + all_fan_dict["Number"] = n_fan + + # Set fan FRU data. + fan_fru_dict = dict() + fan_raw_idx = 1 + for fan_fru in self.fru_data_list: + fru_dict = dict() + fan_ps = False + + if len(fan_fru) == 0: + fan_idx = fan_raw_idx + fan_pn = "N/A" + fan_sn = "N/A" + else: + fan_key = fan_fru[0].split() + if str(fan_key[-1]).lower() == "absent": + fan_idx = int(re.findall('\d+', fan_key[0])[0]) + + else: + fan_idx = int(re.findall('\d+', fan_key[-1])[0]) + fan_ps = True + pn = [s for s in fan_fru if "Part" in s] + sn = [s for s in fan_fru if "Serial" in s] + fan_pn = pn[0].split( + ":")[-1].strip() if len(pn) > 0 else 'N/A' + fan_sn = sn[0].split( + ":")[-1].strip() if len(sn) > 0 else 'N/A' + + fru_dict["PN"] = "N/A" if not fan_pn or fan_pn == "" else fan_pn + fru_dict["SN"] = "N/A" if not fan_sn or fan_sn == "" else fan_sn + fru_dict["Present"] = fan_ps + fan_fru_dict[fan_idx] = fru_dict + fan_raw_idx += 1 + + # Set fan sensor data. + for sensor_data in self.sensor_data_list: + sensor_name = sensor_data.get('name') + if "fan" in str(sensor_name): + for x in range(1, n_fan + 1): + fan_dict = dict() + f_index = int(round(float(x)/2)) + pos = 1 if x % 2 else 2 + position_key = "Front" if x % 2 != 0 else "Rear" + fan_key = "Fan " + str(f_index) + " " + position_key + fan_data = sensor_data.get(fan_key) + fan_sp_list = map(int, re.findall(r'\d+', fan_data)) + fan_dict["Present"] = fan_fru_dict[f_index]["Present"] + if fan_dict["Present"] or fan_sp_list[0] > 0: + fan_dict["Present"] = True + fan_dict["Speed"] = fan_sp_list[0] + fan_dict["Running"] = True if fan_dict["Speed"] > 0 else False + fan_dict["LowThd"] = fan_sp_list[1] + fan_dict["HighThd"] = fan_sp_list[2] + fan_dict["PN"] = fan_fru_dict[f_index]["PN"] + fan_dict["SN"] = fan_fru_dict[f_index]["SN"] + fan_dict["AirFlow"] = "FTOB" if "R1241-F9001" in fan_dict["PN"] else "Unknown" + fan_dict["AirFlow"] = "BTOF" if "R1241-F9002" in fan_dict["PN"] else fan_dict["AirFlow"] + fan_dict["Status"] = True if fan_dict["AirFlow"] != "Unknown" else False + fan_name = 'FAN{}_{}'.format(f_index, pos) + all_fan_dict[fan_name] = fan_dict + break + + return all_fan_dict diff --git a/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/fwmgrutil.py b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/fwmgrutil.py new file mode 100644 index 000000000000..80d2b960b37f --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/fwmgrutil.py @@ -0,0 +1,882 @@ +# fwmgrutil.py +# +# Platform-specific firmware management interface for SONiC +# + +import subprocess +import requests +import os +import pexpect +import base64 +import time +import json +import logging +import ast +from datetime import datetime + +try: + from sonic_fwmgr.fwgmr_base import FwMgrUtilBase +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +class FwMgrUtil(FwMgrUtilBase): + + """Platform-specific FwMgrUtil class""" + + def __init__(self): + self.platform_name = "AS1348f8h" + self.onie_config_file = "/host/machine.conf" + self.bmc_info_url = "http://240.1.1.1:8080/api/sys/bmc" + self.bmc_raw_command_url = "http://240.1.1.1:8080/api/sys/raw" + self.fw_upgrade_url = "http://240.1.1.1:8080/api/sys/upgrade" + self.onie_config_file = "/host/machine.conf" + self.fw_upgrade_logger_path = "/var/log/fw_upgrade.log" + self.cpldb_version_path = "/sys/devices/platform/%s.cpldb/getreg" % self.platform_name + self.fpga_version_path = "/sys/devices/platform/%s.switchboard/FPGA/getreg" % self.platform_name + self.switchboard_cpld1_path = "/sys/devices/platform/%s.switchboard/CPLD1/getreg" % self.platform_name + self.switchboard_cpld2_path = "/sys/devices/platform/%s.switchboard/CPLD2/getreg" % self.platform_name + self.switchboard_cpld3_path = "/sys/devices/platform/%s.switchboard/CPLD3/getreg" % self.platform_name + self.switchboard_cpld4_path = "/sys/devices/platform/%s.switchboard/CPLD4/getreg" % self.platform_name + self.bmc_pwd_path = "/usr/local/etc/bmcpwd" + + def __get_register_value(self, path, register): + cmd = "echo {1} > {0}; cat {0}".format(path, register) + p = subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + raw_data, err = p.communicate() + if err is not '': + return 'None' + else: + return raw_data.strip() + + def __update_fw_upgrade_logger(self, header, message): + if not os.path.isfile(self.fw_upgrade_logger_path): + cmd = "sudo touch %s && sudo chmod +x %s" % ( + self.fw_upgrade_logger_path, self.fw_upgrade_logger_path) + subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + logging.basicConfig(filename=self.fw_upgrade_logger_path, + filemode='a', + format='%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s', + datefmt='%b %d %H:%M:%S', + level=logging.INFO) + + log_message = "%s : %s" % (header, message) + if header != "last_upgrade_result": + print(log_message) + return logging.info(log_message) + + def get_bmc_pass(self): + if os.path.exists(self.bmc_pwd_path): + with open(self.bmc_pwd_path) as file: + data = file.read() + + key = "bmc" + dec = [] + enc = base64.urlsafe_b64decode(data) + for i in range(len(enc)): + key_c = key[i % len(key)] + dec_c = chr((256 + ord(enc[i]) - ord(key_c)) % 256) + dec.append(dec_c) + return "".join(dec) + return False + + def get_bmc_version(self): + """Get BMC version from SONiC + :returns: version string + + """ + bmc_version = None + + bmc_version_key = "OpenBMC Version" + bmc_info_req = requests.get(self.bmc_info_url, timeout=60) + if bmc_info_req.status_code == 200: + bmc_info_json = bmc_info_req.json() + bmc_info = bmc_info_json.get('Information') + bmc_version = bmc_info.get(bmc_version_key) + return str(bmc_version) + + def upload_file_bmc(self, fw_path): + scp_command = 'sudo scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r %s root@240.1.1.1:/home/root/' % os.path.abspath( + fw_path) + child = pexpect.spawn(scp_command) + i = child.expect(["root@240.1.1.1's password:"], timeout=30) + bmc_pwd = self.get_bmc_pass() + if i == 0 and bmc_pwd: + child.sendline(bmc_pwd) + data = child.read() + print(data) + child.close + return os.path.isfile(fw_path) + return False + + def get_cpld_version(self): + """Get CPLD version from SONiC + :returns: dict like {'CPLD_1': version_string, 'CPLD_2': version_string} + """ + + CPLD_B = self.__get_register_value(self.cpldb_version_path, '0xA100') + CPLD_C = self.__get_register_value(self.cpldb_version_path, '0xA1E0') + CPLD_1 = self.__get_register_value(self.switchboard_cpld1_path, '0x00') + CPLD_2 = self.__get_register_value(self.switchboard_cpld2_path, '0x00') + CPLD_3 = self.__get_register_value(self.switchboard_cpld3_path, '0x00') + CPLD_4 = self.__get_register_value(self.switchboard_cpld4_path, '0x00') + + fan_cpld_key = "FanCPLD Version" + fan_cpld = None + bmc_info_req = requests.get(self.bmc_info_url) + if bmc_info_req.status_code == 200: + bmc_info_json = bmc_info_req.json() + bmc_info = bmc_info_json.get('Information') + fan_cpld = bmc_info.get(fan_cpld_key) + + CPLD_B = 'None' if CPLD_B is 'None' else "{}.{}".format( + int(CPLD_B[2], 16), int(CPLD_B[3], 16)) + CPLD_C = 'None' if CPLD_C is 'None' else "{}.{}".format( + int(CPLD_C[2], 16), int(CPLD_C[3], 16)) + CPLD_1 = 'None' if CPLD_1 is 'None' else "{}.{}".format( + int(CPLD_1[2], 16), int(CPLD_1[3], 16)) + CPLD_2 = 'None' if CPLD_2 is 'None' else "{}.{}".format( + int(CPLD_2[2], 16), int(CPLD_2[3], 16)) + CPLD_3 = 'None' if CPLD_3 is 'None' else "{}.{}".format( + int(CPLD_3[2], 16), int(CPLD_3[3], 16)) + CPLD_4 = 'None' if CPLD_4 is 'None' else "{}.{}".format( + int(CPLD_4[2], 16), int(CPLD_4[3], 16)) + FAN_CPLD = 'None' if fan_cpld is None else "{}.{}".format( + int(fan_cpld[0], 16), int(fan_cpld[1], 16)) + + cpld_version_dict = {} + cpld_version_dict.update({'CPLD_B': CPLD_B}) + cpld_version_dict.update({'CPLD_C': CPLD_C}) + cpld_version_dict.update({'CPLD_1': CPLD_1}) + cpld_version_dict.update({'CPLD_2': CPLD_2}) + cpld_version_dict.update({'CPLD_3': CPLD_3}) + cpld_version_dict.update({'CPLD_4': CPLD_4}) + cpld_version_dict.update({'CPLD_FAN': FAN_CPLD}) + + return cpld_version_dict + + def get_bios_version(self): + """Get BIOS version from SONiC + :returns: version string + + """ + bios_version = None + + p = subprocess.Popen( + ["sudo", "dmidecode", "-s", "bios-version"], stdout=subprocess.PIPE) + raw_data = str(p.communicate()[0]) + if raw_data == '': + return str(None) + raw_data_list = raw_data.split("\n") + bios_version = raw_data_list[0] if len( + raw_data_list) == 1 else raw_data_list[-2] + + return str(bios_version) + + def get_onie_version(self): + """Get ONiE version from SONiC + :returns: version string + + """ + onie_verison = None + + onie_version_keys = "onie_version" + onie_config_file = open(self.onie_config_file, "r") + for line in onie_config_file.readlines(): + if onie_version_keys in line: + onie_version_raw = line.split('=') + onie_verison = onie_version_raw[1].strip() + break + onie_config_file.close() + return str(onie_verison) + + def get_pcie_version(self): + """Get PCiE version from SONiC + :returns: version dict { "PCIE_FW_LOADER": "2.5", "PCIE_FW": "D102_08" } + + """ + cmd = "sudo bcmcmd 'pciephy fw version'" + p = subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + raw_data, err = p.communicate() + + pcie_version = dict() + pcie_version["PCIE_FW_LOADER"] = 'None' + pcie_version["PCIE_FW"] = 'None' + + if err == '': + lines = raw_data.split('\n') + for line in lines: + if 'PCIe FW loader' in line: + pcie_version["PCIE_FW_LOADER"] = line.split(':')[1].strip() + elif 'PCIe FW version' in line: + pcie_version["PCIE_FW"] = line.split(':')[1].strip() + return pcie_version + + def get_fpga_version(self): + """Get FPGA version from SONiC + :returns: version string + + """ + version = self.__get_register_value(self.fpga_version_path, '0x00') + if version is not 'None': + version = "{}.{}".format( + int(version[2:][:4], 16), int(version[2:][4:], 16)) + return str(version) + + def firmware_upgrade(self, fw_type, fw_path, fw_extra=None): + """ + @fw_type MANDATORY, firmware type, should be one of the strings: 'cpld', 'fpga', 'bios', 'bmc' + @fw_path MANDATORY, target firmware file + @fw_extra OPTIONAL, extra information string, + + for fw_type 'cpld' and 'fpga': it can be used to indicate specific cpld, such as 'cpld1', 'cpld2', ... + or 'cpld_fan_come_board', etc. If None, upgrade all CPLD/FPGA firmware. for fw_type 'bios' and 'bmc', + value should be one of 'master' or 'slave' or 'both' + """ + fw_type = fw_type.lower() + bmc_pwd = self.get_bmc_pass() + if not bmc_pwd and fw_type != "fpga": + self.__update_fw_upgrade_logger( + "fw_upgrade", "fail, message=BMC credential not found") + return False + + if fw_type == 'bmc': + self.__update_fw_upgrade_logger( + "bmc_upgrade", "start BMC upgrade") + # Copy BMC image file to BMC + fw_extra_str = str(fw_extra).lower() + last_fw_upgrade = ["BMC", fw_path, fw_extra_str, "FAILED"] + upload_file = self.upload_file_bmc(fw_path) + if not upload_file: + self.__update_fw_upgrade_logger( + "fw_upgrade", "fail, message=unable to upload BMC image to BMC") + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return False + + filename_w_ext = os.path.basename(fw_path) + json_data = dict() + json_data["path"] = "root@127.0.0.1:/home/root/%s" % filename_w_ext + json_data["password"] = bmc_pwd + + # Set flash type + current_bmc = self.get_running_bmc() + flash = fw_extra_str if fw_extra_str in [ + "master", "slave", "both"] else "both" + if fw_extra_str == "pingpong": + #flash = "master" if current_bmc == "slave" else "slave" + flash = "slave" + json_data["flash"] = flash + + # Install BMC + if flash == "both": + self.__update_fw_upgrade_logger( + "bmc_upgrade", "install BMC as master mode") + json_data["flash"] = "master" + r = requests.post(self.bmc_info_url, json=json_data) + if r.status_code != 200 or 'success' not in r.json().get('result'): + self.__update_fw_upgrade_logger( + "bmc_upgrade", "fail, message=BMC API report error code %d" % r.status_code) + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return False + json_data["flash"] = "slave" + + self.__update_fw_upgrade_logger( + "bmc_upgrade", "install BMC as %s mode" % json_data["flash"]) + r = requests.post(self.bmc_info_url, json=json_data) + if r.status_code == 200 and 'success' in r.json().get('result'): + if fw_extra_str == "pingpong": + flash = "master" if current_bmc == "slave" else "slave" + self.__update_fw_upgrade_logger( + "bmc_upgrade", "switch to boot from %s" % flash) + self.set_bmc_boot_flash(flash) + self.__update_fw_upgrade_logger( + "bmc_upgrade", "reboot BMC") + if not self.reboot_bmc(): + return False + else: + self.__update_fw_upgrade_logger( + "bmc_upgrade", "reboot BMC") + reboot_dict = {} + reboot_dict["reboot"] = "yes" + r = requests.post(self.bmc_info_url, json=reboot_dict) + last_fw_upgrade[3] = "DONE" + else: + self.__update_fw_upgrade_logger( + "bmc_upgrade", "fail, message=unable to install BMC image") + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return False + + self.__update_fw_upgrade_logger( + "bmc_upgrade", "done") + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return True + + elif fw_type == 'fpga': + last_fw_upgrade = ["FPGA", fw_path, None, "FAILED"] + self.__update_fw_upgrade_logger( + "fpga_upgrade", "start FPGA upgrade") + + if not os.path.isfile(fw_path): + self.__update_fw_upgrade_logger( + "fpga_upgrade", "fail, message=FPGA image not found %s" % fw_path) + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return False + + command = 'fpga_prog ' + fw_path + print("Running command : %s" % command) + process = subprocess.Popen( + command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + while True: + output = process.stdout.readline() + if output == '' and process.poll() is not None: + break + + rc = process.returncode + if rc != 0: + self.__update_fw_upgrade_logger( + "fw_upgrade", "fail, message=unable to install FPGA") + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return False + + self.__update_fw_upgrade_logger("fpga_upgrade", "done") + last_fw_upgrade[3] = "DONE" + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + self.firmware_refresh(["FPGA"], None, None) + return True + + elif 'cpld' in fw_type: + self.__update_fw_upgrade_logger( + "cpld_upgrade", "start CPLD upgrade") + # Check input + fw_extra_str = str(fw_extra).upper() + if ":" in fw_path and ":" in fw_extra_str: + fw_path_list = fw_path.split(":") + fw_extra_str_list = fw_extra_str.split(":") + else: + fw_path_list = [fw_path] + fw_extra_str_list = [fw_extra_str] + + if len(fw_path_list) != len(fw_extra_str_list): + self.__update_fw_upgrade_logger( + "cpld_upgrade", "fail, message=invalid input") + return False + + data_list = list(zip(fw_path_list, fw_extra_str_list)) + refresh_img_path = None + cpld_result_list = ["FAILED" for i in range( + 0, len(fw_extra_str_list))] + last_fw_upgrade = ["CPLD", ":".join( + fw_path_list), ":".join(fw_extra_str_list), ":".join(cpld_result_list)] + for i in range(0, len(data_list)): + data = data_list[i] + fw_path = data[0] + fw_extra_str = data[1] + + # Set fw_extra + fw_extra_str = { + "TOP_LC_CPLD": "top_lc", + "BOT_LC_CPLD": "bottom_lc", + "FAN_CPLD": "fan", + "CPU_CPLD": "cpu", + "BASE_CPLD": "base", + "COMBO_CPLD": "combo", + "SW_CPLD1": "switch", + "SW_CPLD2": "switch", + "REFRESH_CPLD": "refresh" + }.get(fw_extra_str, None) + + if fw_extra_str == "refresh": + refresh_img_path = fw_path + del cpld_result_list[i] + del fw_extra_str_list[i] + continue + + if fw_extra_str is None: + self.__update_fw_upgrade_logger( + "cpld_upgrade", "fail, message=invalid extra information string") + continue + + # Uploading image to BMC + self.__update_fw_upgrade_logger( + "cpld_upgrade", "start %s upgrade" % data[1]) + upload_file = self.upload_file_bmc(fw_path) + if not upload_file: + self.__update_fw_upgrade_logger( + "cpld_upgrade", "fail, message=unable to upload BMC image to BMC") + continue + + filename_w_ext = os.path.basename(fw_path) + json_data = dict() + json_data["image_path"] = "root@127.0.0.1:/home/root/%s" % filename_w_ext + json_data["password"] = bmc_pwd + json_data["device"] = "cpld" + json_data["reboot"] = "no" + json_data["type"] = fw_extra_str + + # Call BMC api to install cpld image + print("Installing...") + r = requests.post(self.fw_upgrade_url, json=json_data) + if r.status_code != 200 or 'success' not in r.json().get('result'): + self.__update_fw_upgrade_logger( + "cpld_upgrade", "fail, message=invalid cpld image") + continue + + cpld_result_list[i] = "DONE" + self.__update_fw_upgrade_logger( + "cpld_upgrade", "%s upgrade done" % data[1]) + last_fw_upgrade[3] = ":".join(cpld_result_list) + self.__update_fw_upgrade_logger( + "cpld_upgrade", "done") + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + + # Refresh CPLD + refresh_img_str_list = [] + for fw_extra in fw_extra_str_list: + if "BASE_CPLD" in fw_extra or "FAN_CPLD" in fw_extra: + refresh_img_str_list.append(refresh_img_path) + else: + refresh_img_str_list.append("None") + self.firmware_refresh(None, fw_extra_str_list, + ":".join(refresh_img_str_list)) + + return True + + elif 'bios' in fw_type: + self.__update_fw_upgrade_logger( + "bios_upgrade", "start BIOS upgrade") + last_fw_upgrade = ["BIOS", fw_path, None, "FAILED"] + fw_extra_str = str(fw_extra).lower() + flash = fw_extra_str if fw_extra_str in [ + "master", "slave"] else "master" + + if not os.path.exists(fw_path): + self.__update_fw_upgrade_logger( + "bios_upgrade", "fail, message=image not found") + return False + + scp_command = 'sudo scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r %s root@240.1.1.1:/home/root/' % os.path.abspath( + fw_path) + child = pexpect.spawn(scp_command) + i = child.expect(["root@240.1.1.1's password:"], timeout=30) + if i != 0: + self.__update_fw_upgrade_logger( + "bios_upgrade", "fail, message=unable to upload image to BMC") + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return False + + child.sendline(bmc_pwd) + data = child.read() + print(data) + child.close + + json_data = dict() + json_data["data"] = "/usr/bin/ipmitool -b 1 -t 0x2c raw 0x2e 0xdf 0x57 0x01 0x00 0x01" + r = requests.post(self.bmc_raw_command_url, json=json_data) + if r.status_code != 200: + self.__update_fw_upgrade_logger( + "bios_upgrade", "fail, message=unable to set state") + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return False + + filename_w_ext = os.path.basename(fw_path) + json_data = dict() + json_data["image_path"] = "root@127.0.0.1:/home/root/%s" % filename_w_ext + json_data["password"] = bmc_pwd + json_data["device"] = "bios" + json_data["flash"] = flash + json_data["reboot"] = "no" + + print("Installing...") + r = requests.post(self.fw_upgrade_url, json=json_data) + if r.status_code != 200 or 'success' not in r.json().get('result'): + self.__update_fw_upgrade_logger( + "bios_upgrade", "fail, message=unable install bios") + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return False + + last_fw_upgrade[3] = "DONE" + self.__update_fw_upgrade_logger( + "bios_upgrade", "done") + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + else: + self.__update_fw_upgrade_logger( + "fw_upgrade", "fail, message=invalid firmware type") + return False + + return True + + def get_last_upgrade_result(self): + """ + Get last firmware upgrade information, inlcudes: + 1) FwType: cpld/fpga/bios/bmc(passed by method 'firmware_upgrade'), string + 2) FwPath: path and file name of firmware(passed by method 'firmware_upgrade'), string + 3) FwExtra: designated string, econdings of this string is determined by vendor(passed by method 'firmware_program') + 4) Result: indicates whether the upgrade action is performed and success/failure status if performed. Values should be one of: "DONE"/"FAILED"/"NOT_PERFORMED". + list of object: + [ + { + "FwType": "cpld", + "FwPath": "cpu_cpld.vme" + "FwExtra":"CPU_CPLD" + "Result": "DONE" + }, + { + "FwType": "cpld", + "FwPath": "fan_cpld.vme" + "FwExtra": "FAN_CPLD" + "Result": "FAILED" + } + ] + """ + last_update_list = [] + + if os.path.exists(self.fw_upgrade_logger_path): + with open(self.fw_upgrade_logger_path, 'r') as file: + lines = file.read().splitlines() + + upgrade_txt = [i for i in reversed( + lines) if "last_upgrade_result" in i] + if len(upgrade_txt) > 0: + last_upgrade_txt = upgrade_txt[0].split( + "last_upgrade_result : ") + last_upgrade_list = ast.literal_eval(last_upgrade_txt[1]) + for x in range(0, len(last_upgrade_list[1].split(":"))): + upgrade_dict = {} + upgrade_dict["FwType"] = last_upgrade_list[0].lower() + upgrade_dict["FwPath"] = last_upgrade_list[1].split(":")[x] + upgrade_dict["FwExtra"] = last_upgrade_list[2].split(":")[ + x] if last_upgrade_list[2] else "None" + upgrade_dict["Result"] = last_upgrade_list[3].split(":")[x] + last_update_list.append(upgrade_dict) + + return last_update_list + + def firmware_program(self, fw_type, fw_path, fw_extra=None): + """ + Program FPGA and/or CPLD firmware only, but do not refresh them + + @param fw_type value can be: FPGA, CPLD + @param fw_path a string of firmware file path, seperated by ':', it should + match the sequence of param @fw_type + @param fw_extra a string of firmware subtype, i.e CPU_CPLD, BOARD_CPLD, + FAN_CPLD, LC_CPLD, etc. Subtypes are seperated by ':' + @return True when all required firmware is program succefully, + False otherwise. + + Example: + self.firmware_program("CPLD", "/cpu_cpld.vme:/lc_cpld", \ + "CPU_CPLD:LC_CPLD") + or + self.firmware_program("FPGA", "/fpga.bin") + """ + fw_type = fw_type.lower() + bmc_pwd = self.get_bmc_pass() + if not bmc_pwd and fw_type != "fpga": + self.__update_fw_upgrade_logger( + "fw_upgrade", "fail, message=BMC credential not found") + return False + + if fw_type == 'fpga': + last_fw_upgrade = ["FPGA", fw_path, None, "FAILED"] + self.__update_fw_upgrade_logger( + "fpga_upgrade", "start FPGA upgrade") + + if not os.path.isfile(fw_path): + self.__update_fw_upgrade_logger( + "fpga_upgrade", "fail, message=FPGA image not found %s" % fw_path) + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return False + + command = 'fpga_prog ' + fw_path + print("Running command: %s" % command) + process = subprocess.Popen( + command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + while True: + output = process.stdout.readline() + if output == '' and process.poll() is not None: + break + + rc = process.returncode + if rc != 0: + self.__update_fw_upgrade_logger( + "fw_upgrade", "fail, message=Unable to install FPGA") + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return False + + self.__update_fw_upgrade_logger("fpga_upgrade", "done") + last_fw_upgrade[3] = "DONE" + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return True + + elif 'cpld' in fw_type: + self.__update_fw_upgrade_logger( + "cpld_upgrade", "start CPLD upgrade") + + # Check input + fw_extra_str = str(fw_extra).upper() + if ":" in fw_path and ":" in fw_extra_str: + fw_path_list = fw_path.split(":") + fw_extra_str_list = fw_extra_str.split(":") + else: + fw_path_list = [fw_path] + fw_extra_str_list = [fw_extra_str] + + if len(fw_path_list) != len(fw_extra_str_list): + self.__update_fw_upgrade_logger( + "cpld_upgrade", "fail, message=Invalid input") + return False + + cpld_result_list = [] + data_list = list(zip(fw_path_list, fw_extra_str_list)) + for data in data_list: + fw_path = data[0] + fw_extra_str = data[1] + + # Set fw_extra + fw_extra_str = { + "TOP_LC_CPLD": "top_lc", + "BOT_LC_CPLD": "bottom_lc", + "FAN_CPLD": "fan", + "CPU_CPLD": "cpu", + "BASE_CPLD": "base", + "COMBO_CPLD": "combo", + "SW_CPLD1": "switch", + "SW_CPLD2": "switch" + }.get(fw_extra_str, None) + + self.__update_fw_upgrade_logger( + "cpld_upgrade", "start %s upgrade" % data[1]) + upgrade_result = "FAILED" + for x in range(1, 4): + # Set fw_extra + if x > 1: + self.__update_fw_upgrade_logger( + "cpld_upgrade", "fail, message=Retry to upgrade %s" % data[1]) + + elif fw_extra_str is None: + self.__update_fw_upgrade_logger( + "cpld_upgrade", "fail, message=Invalid extra information string %s" % data[1]) + break + elif not os.path.isfile(os.path.abspath(fw_path)): + self.__update_fw_upgrade_logger( + "cpld_upgrade", "fail, message=CPLD image not found %s" % fw_path) + break + + # Install cpld image via ispvm tool + print("Installing...") + command = 'ispvm %s' % fw_path + if fw_extra_str in ["top_lc", "bottom_lc"]: + option = 1 if fw_extra_str == "top_lc" else 2 + command = "ispvm -c %d %s" % (option, + os.path.abspath(fw_path)) + print("Running command : %s" % command) + process = subprocess.Popen( + command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + while True: + output = process.stdout.readline() + if output == '' and process.poll() is not None: + break + + rc = process.returncode + if rc != 0: + self.__update_fw_upgrade_logger( + "cpld_upgrade", "fail, message=Unable to install CPLD") + continue + + upgrade_result = "DONE" + self.__update_fw_upgrade_logger("cpld_upgrade", "done") + break + cpld_result_list.append(upgrade_result) + + last_fw_upgrade = ["CPLD", ":".join( + fw_path_list), ":".join(fw_extra_str_list), ":".join(cpld_result_list)] + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return "FAILED" not in cpld_result_list + else: + self.__update_fw_upgrade_logger( + "fw_upgrade", "fail, message=Invalid firmware type") + return False + + return True + + def firmware_refresh(self, fpga_list, cpld_list, fw_extra=None): + """ + Refresh firmware and take extra action when necessary. + @param fpga_list a list of FPGA names + @param cpld_list a list of CPLD names + @return True if refresh succefully and no power cycle action is taken. + + @Note extra action should be: power cycle the whole system(except BMC) when + CPU_CPLD or BOARD_CPLD or FPGA is refreshed. + No operation if the power cycle is not needed. + + Example: + self.firmware_refresh( + ["FPGA"], ["BASE_CPLD", "LC_CPLD"],"/tmp/fw/refresh.vme") + or + self.firmware_refresh(["FPGA"], None, None) + or + self.firmware_refresh(None, ["FAN_CPLD", "LC1_CPLD", "BASE_CPLD"], + "/tmp/fw/fan_refresh.vme:none:/tmp/fw/base_refresh.vme") + """ + + if not fpga_list and not cpld_list: + return False + + if type(cpld_list) is list and ("BASE_CPLD" in cpld_list or "FAN_CPLD" in cpld_list): + refresh_list = fpga_list + \ + cpld_list if type(fpga_list) is list else cpld_list + self.__update_fw_upgrade_logger( + "fw_refresh", "start %s refresh" % ",".join(refresh_list)) + fw_path_list = fw_extra.split(':') + command = "echo " + if len(fw_path_list) != len(cpld_list): + self.__update_fw_upgrade_logger( + "cpld_refresh", "fail, message=Invalid fw_extra") + return False + + for idx in range(0, len(cpld_list)): + fw_path = fw_path_list[idx] + refresh_type = { + "BASE_CPLD": "base", + "FAN_CPLD": "fan" + }.get(cpld_list[idx], None) + + if not refresh_type: + continue + elif not self.upload_file_bmc(fw_path): + self.__update_fw_upgrade_logger( + "cpld_refresh", "fail, message=Unable to upload refresh image to BMC") + return False + else: + filename_w_ext = os.path.basename(fw_path) + + sub_command = "%s /home/root/%s > /tmp/cpld_refresh " % ( + refresh_type, filename_w_ext) + command += sub_command + + json_data = dict() + json_data["data"] = command + r = requests.post(self.bmc_raw_command_url, json=json_data) + if r.status_code != 200: + self.__update_fw_upgrade_logger( + "cpld_refresh", "fail, message=%d Invalid refresh image" % r.status_code) + return False + elif type(cpld_list) is list: + refresh_list = fpga_list + \ + cpld_list if type(fpga_list) is list else cpld_list + self.__update_fw_upgrade_logger( + "fw_refresh", "start %s refresh" % ",".join(refresh_list)) + json_data = dict() + json_data["data"] = "echo cpu_cpld > /tmp/cpld_refresh" + r = requests.post(self.bmc_raw_command_url, json=json_data) + if r.status_code != 200: + self.__update_fw_upgrade_logger( + "cpld_refresh", "fail, message=%d Unable to load new CPLD" % r.status_code) + return False + elif type(fpga_list) is list: + self.__update_fw_upgrade_logger( + "fw_refresh", "start FPGA refresh") + json_data = dict() + json_data["data"] = "echo fpga > /tmp/cpld_refresh" + r = requests.post(self.bmc_raw_command_url, json=json_data) + if r.status_code != 200: + self.__update_fw_upgrade_logger( + "cpld_refresh", "fail, message=%d Unable to load new FPGA" % r.status_code) + return False + else: + self.__update_fw_upgrade_logger( + "fw_refresh", "fail, message=Invalid input") + return False + + self.__update_fw_upgrade_logger("fw_refresh", "done") + return True + + def get_running_bmc(self): + """ + Get booting flash of running BMC. + @return a string, "master" or "slave" + """ + json_data = dict() + json_data["data"] = "/usr/local/bin/boot_info.sh" + r = requests.post(self.bmc_raw_command_url, json=json_data) + try: + boot_info_list = r.json().get('result') + for boot_info_raw in boot_info_list: + boot_info = boot_info_raw.split(":") + if "Current Boot Code Source" in boot_info[0]: + flash = "master" if "master "in boot_info[1].lower( + ) else "slave" + return flash + raise Exception( + "Error: Unable to detect booting flash of running BMC") + except Exception as e: + raise Exception(e) + + def set_bmc_boot_flash(self, flash): + """ + Set booting flash of BMC + @param flash should be "master" or "slave" + """ + if flash.lower() not in ["master", "slave"]: + return False + json_data = dict() + json_data["data"] = "source /usr/local/bin/openbmc-utils.sh;bmc_reboot %s" % flash + r = requests.post(self.bmc_raw_command_url, json=json_data) + if r.status_code != 200: + return False + return True + + def reboot_bmc(self): + """ + Reboot BMC + """ + json_data = dict() + json_data["data"] = "source /usr/local/bin/openbmc-utils.sh;bmc_reboot reboot" + r = requests.post(self.bmc_raw_command_url, json=json_data) + if r.status_code != 200: + return False + return True + + def get_current_bios(self): + """ + # Get booting bios image of current running host OS + # @return a string, "master" or "slave" + """ + json_data = dict() + json_data["data"] = "source /usr/local/bin/openbmc-utils.sh;come_boot_info" + r = requests.post(self.bmc_raw_command_url, json=json_data) + try: + cpu_boot_info_list = r.json().get('result') + for cpu_boot_info_raw in cpu_boot_info_list: + if "COMe CPU boots from BIOS" in cpu_boot_info_raw: + bios_image = "master" if "master "in cpu_boot_info_raw.lower( + ) else "slave" + return bios_image + raise Exception( + "Error: Unable to detect current running bios image") + except Exception as e: + raise Exception(e) diff --git a/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/optictemputil.py b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/optictemputil.py new file mode 100644 index 000000000000..0e5b6a1c7109 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/optictemputil.py @@ -0,0 +1,126 @@ +#!/usr/bin/env python + +# +# optictemputil.py +# +# Platform-specific Optic module temperature Interface for SONiC +# + +__author__ = 'Pradchaya P.' +__author__ = 'Wirut G.' +__license__ = "GPL" +__version__ = "1.0.0" +__status__ = "Development" + +import os +import sys +import binascii +import subprocess + +class OpticTempUtil(): + """Platform-specific OpticTempUtil class""" + + def __init__(self): + pass + + def read_eeprom_specific_bytes(self, sysfsfile_eeprom, offset, num_bytes): + eeprom_raw = [] + for i in range(0, num_bytes): + eeprom_raw.append("0x00") + + try: + sysfsfile_eeprom.seek(offset) + raw = sysfsfile_eeprom.read(num_bytes) + except IOError: + return None + + try: + for n in range(0, num_bytes): + eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) + except: + return None + + return eeprom_raw + + + def twos_comp(self, num, bits): + try: + if ((num & (1 << (bits - 1))) != 0): + num = num - (1 << bits) + return num + except: + return 0 + + + def calc_temperature(self, cal_type, eeprom_data, offset, size): + + msb = int(eeprom_data[offset], 16) + lsb = int(eeprom_data[offset + 1], 16) + + result = (msb << 8) | (lsb & 0xff) + result = self.twos_comp(result, 16) + + if cal_type == 1: + # Internal calibration + result = float(result / 256.0) + retval = '%.4f' %result + + # TODO: Should support external calibration in future. + else: + retval = 0 + + return retval + + ''' TODO: Change busnum to sysfs_sfp_i2c_client_eeprom_path from caller!!! + ''' + def get_optic_temp(self, sysfs_sfp_i2c_client_eeprom_path, port_type): + + EEPROM_ADDR = 0x50 + DOM_ADDR = 0x51 + EEPROM_OFFSET = 0 + DOM_OFFSET = 256 + + SFP_DMT_ADDR = 92 + SFP_DMT_WIDTH = 1 + SFP_TEMP_DATA_ADDR = 96 + SFP_TEMP_DATA_WIDTH = 2 + + QSFP_TEMP_DATA_ADDR = 22 + QSFP_TEMP_DATA_WIDTH = 2 + temperature_raw = None + + + ''' Open file here ''' + try: + sysfsfile_eeprom = open(sysfs_sfp_i2c_client_eeprom_path, mode="rb", buffering=0) + except IOError: + print("Error: reading sysfs file %s" % sysfs_sfp_i2c_client_eeprom_path) + return 0 + + if port_type == 'QSFP': + + # QSFP only have internal calibration mode. + cal_type = 1 + # read temperature raw value + temperature_raw = self.read_eeprom_specific_bytes(sysfsfile_eeprom,(EEPROM_OFFSET+QSFP_TEMP_DATA_ADDR),QSFP_TEMP_DATA_WIDTH) + else: + # read calibration type at bit 5 + cal_type = self.read_eeprom_specific_bytes(sysfsfile_eeprom,EEPROM_OFFSET+SFP_DMT_ADDR,SFP_DMT_WIDTH) + if cal_type is None: + return 0 + else: + cal_type = (int(cal_type[0],16) >> 5 ) & 1 + # read temperature raw value + temperature_raw = self.read_eeprom_specific_bytes(sysfsfile_eeprom,(DOM_OFFSET+SFP_TEMP_DATA_ADDR),SFP_TEMP_DATA_WIDTH) + + try: + sysfsfile_eeprom.close() + except IOError: + print("Error: closing sysfs file %s" % file_path) + return 0 + + #calculate temperature + if temperature_raw is not None: + return self.calc_temperature(cal_type, temperature_raw, 0, 2) + else: + return 0 \ No newline at end of file diff --git a/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/psuutil.py b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/psuutil.py new file mode 100644 index 000000000000..d3a27117f5a2 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/psuutil.py @@ -0,0 +1,248 @@ +#!/usr/bin/env python + +__author__ = 'Wirut G.' +__license__ = "GPL" +__version__ = "0.1.4" +__status__ = "Development" + +import requests +import re + +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.fru_status_url = "http://240.1.1.1:8080/api/sys/fruid/status" + self.psu_info_url = "http://240.1.1.1:8080/api/sys/fruid/psu" + + self.fru_status_list = None + self.psu_info_list = None + + def request_data(self): + # Reqest data from BMC if not exist. + if self.fru_status_list is None or self.psu_info_list is None: + fru_status_req = requests.get(self.fru_status_url) + psu_info_req = requests.get(self.psu_info_url) + fru_status_json = fru_status_req.json() + psu_info_json = psu_info_req.json() + self.fru_status_list = fru_status_json.get('Information') + self.psu_info_list = psu_info_json.get('Information') + return self.fru_status_list, self.psu_info_list + + def airflow_selector(self, pn): + # Set airflow type + pn = pn.upper() + if "DPS-1100FB" in pn: + airflow = "FTOB" + elif "DPS-1100AB" in pn: + airflow = "BTOF" + elif "FSJ026-A20G" in pn: + airflow = "FTOB" + elif "FSJ038-A20G" in pn: + airflow = "BTOF" + else: + airflow = "Unknown" + return airflow + + 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 + """ + + num_psus = 2 + + return num_psus + + 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 + """ + + # init data + psu_key = "PSU" + str(index) + psu_status_key = "Power Status" + psu_power_status = False + + try: + # Request and validate sensor's information + self.fru_status_list, self.psu_info_list = self.request_data() + + # Get PSU power status. + for fru_status in self.fru_status_list: + is_psu = fru_status.get(psu_key) + psu_status = str(fru_status.get(psu_status_key)).strip() + + if is_psu is not None and psu_status == "OK": + psu_power_status = True + + except: + print("Error: Unable to access PSU power status") + return False + + return psu_power_status + + 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 + """ + + # Init data + psu_key = "PSU" + str(index) + psu_presence_key = "Present" + psu_presence_status = False + + try: + # Request and validate sensor's information. + self.fru_status_list, self.psu_info_list = self.request_data() + + # Get PSU present status. + for fru_status in self.fru_status_list: + is_psu = fru_status.get(psu_key) + psu_status = str(fru_status.get(psu_presence_key)).strip() + + if is_psu is not None and psu_status == "Present": + psu_presence_status = True + + except: + print("Error: Unable to access PSU presence status") + return False + + return psu_presence_status + + def get_psu_sn(self, index): + """ + Get the serial number of the psu, + + :param index: An integer, 1-based index of the PSU. + :return: Serial number + """ + serial_number = "N/A" + psu_key = "PSU" + str(index) + " FRU" + psu_sn_key = "Serial Number" + + try: + # Request and validate sensor's information. + self.fru_status_list, self.psu_info_list = self.request_data() + + # Get PSU fru info. + for psu_fru in self.psu_info_list: + psu_sn = str(psu_fru.get(psu_sn_key)).strip() + if psu_fru.get(psu_key) is not None: + serial_number = psu_sn if psu_sn.strip() != "" else "N/A" + break + + except: + return "N/A" + + return serial_number + + def get_psu_pn(self, index): + """ + Get the product name of the psu + + :param index: An integer, 1-based index of the PSU. + :return: Product name + """ + product_name = "N/A" + psu_key = "PSU" + str(index) + " FRU" + psu_pn_key = "Product Name" + + try: + # Request and validate sensor's information + self.fru_status_list, self.psu_info_list = self.request_data() + + # Get PSU fru info. + for psu_fru in self.psu_info_list: + psu_pn = str(psu_fru.get(psu_pn_key)).strip() + if psu_fru.get(psu_key) is not None: + product_name = psu_pn if psu_pn.strip() != "" else "N/A" + break + + except: + return "N/A" + + return product_name + + def get_all(self): + """ + Number: mandatory, max number of PSU, integer + PSU1, PSU2, ...: mandatory, PSU name, string + Present: mandatory for each PSU, present status, boolean, True for present, False for NOT present + PowerStatus: conditional, if PRESENT is True, power status of PSU,boolean, True for powered, False for NOT powered + PN, conditional, if PRESENT is True, PN of the PSU, string + SN, conditional, if PRESENT is True, SN of the PSU, string + """ + + # Init data + all_psu_dict = dict() + all_psu_dict["Number"] = self.get_num_psus() + psu_sn_key_1 = "Serial Number" + psu_sn_key_2 = "Product Serial" + psu_pn_key = "Product Name" + + # Request and validate sensor's information. + self.fru_status_list, self.psu_info_list = self.request_data() + + # Set PSU FRU data. + psu_info_dict = dict() + for psu_fru in self.psu_info_list: + psu_data = dict() + pn = psu_fru.get(psu_pn_key) + sn = psu_fru.get(psu_sn_key_1) or psu_fru.get(psu_sn_key_2) + psu_data["PN"] = "N/A" if not pn or str( + pn).strip() == "" else str(pn).strip() + psu_data["SN"] = "N/A" if not pn or str( + pn).strip() == "" else str(sn).strip() + + fru_check = [psu_fru[v] for v in psu_fru.keys() if 'FRU Info' in v] + non_fru_check = [v for v in psu_fru.keys() if 'PSU' in v] + + if len(non_fru_check) > 0: + psu_idx = int(re.findall('\d+', non_fru_check[0])[0]) + psu_info_dict[psu_idx] = psu_data + elif len(fru_check) > 0: + psu_idx = int(re.findall('\d+', fru_check[0])[0]) + psu_info_dict[psu_idx] = psu_data + + # Set PSU status. + for fru_status in self.fru_status_list: + psu_status_dict = dict() + find_psu = [v for v in fru_status.keys() if "PSU" in v] + if len(find_psu) > 0: + psu_idx = int(re.findall('\d+', find_psu[0])[0]) + psu_ps_status = True if str(fru_status.get( + "Present")).strip() == "Present" else False + psu_pw_status = True if str(fru_status.get( + "Power Status")).strip() == "OK" else False + psu_pw_type = str(fru_status.get( + "Power Type")).strip() + ac_status = True if str(fru_status.get( + "AC Status")).strip().upper() == "OK" else False + + psu_status_dict["Present"] = psu_ps_status + if psu_ps_status: + psu_status_dict["PowerStatus"] = psu_pw_status + psu_status_dict["PN"] = psu_info_dict[psu_idx]["PN"] + psu_status_dict["SN"] = psu_info_dict[psu_idx]["SN"] + psu_status_dict["InputType"] = psu_pw_type + psu_status_dict["InputStatus"] = True if psu_pw_status and psu_ps_status else False + psu_status_dict["OutputStatus"] = ac_status + psu_status_dict["AirFlow"] = self.airflow_selector( + psu_status_dict["PN"]) + all_psu_dict[find_psu[0]] = psu_status_dict + + return all_psu_dict diff --git a/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/sensorutil.py b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/sensorutil.py new file mode 100644 index 000000000000..44e48e743b57 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/sensorutil.py @@ -0,0 +1,370 @@ +#!/usr/bin/env python + +__author__ = 'Wirut G.' +__license__ = "GPL" +__version__ = "0.2.0" +__status__ = "Development" + +import requests + + +class SensorUtil(): + """Platform-specific SensorUtil class""" + + def __init__(self): + self.sensor_url = "http://240.1.1.1:8080/api/sys/sensors" + self.sys_fruid_url = "http://240.1.1.1:8080/api/sys/fruid/sys" + self.sensor_info_list = None + + def request_data(self): + # Reqest data from BMC if not exist. + if self.sensor_info_list is None: + sensor_data_req = requests.get(self.sensor_url) + sensor_json = sensor_data_req.json() + self.sensor_info_list = sensor_json.get('Information') + sys_fruid_req = requests.get(self.sys_fruid_url) + sys_fruid_json = sys_fruid_req.json() + self.sys_fruid_list = sys_fruid_json.get('Information') + return self.sensor_info_list + + def input_type_selector(self, unit): + # Set input type. + return { + "C": "temperature", + "V": "voltage", + "RPM": "RPM", + "A": "amp", + "W": "power" + }.get(unit, unit) + + def input_name_selector(self, sensor_name, input_name): + + self.sensor_name = { + "syscpld-i2c-0-0d": "TEMPERATURE", + "dps1100-i2c-24-58": "PSU1", + "dps1100-i2c-25-59": "PSU2", + "fancpld-i2c-8-0d": "FAN" + }.get(sensor_name, sensor_name) + + if 'dps1100' in sensor_name: + input_name = { + "fan1": self.sensor_name + "_FAN", + "iin": self.sensor_name + "_CURR_I", + "iout1": self.sensor_name + "_CURR_O", + "pin": self.sensor_name + "_POWER_I", + "pout1": self.sensor_name + "_POWER_O", + "temp1": self.sensor_name + "_TEMP1", + "temp2": self.sensor_name + "_TEMP2", + "vin": self.sensor_name + "_VOL_I", + "vout1": self.sensor_name + "_VOL_O" + }.get(input_name, input_name) + + elif 'tmp75' in sensor_name: + input_name = { + "tmp75-i2c-7-4d": "FTB_INLET_RIGHT", + "tmp75-i2c-7-4c": "FTB_INLET_LEFT", + "tmp75-i2c-7-4b": "FTB_SWITCH_OUTLET", + "tmp75-i2c-7-4a": "BTF_SWITCH_OUTLET", + "tmp75-i2c-39-48": "BTF_INLET_RIGHT", + "tmp75-i2c-39-49": "BTF_INLET_LEFT" + }.get(sensor_name, input_name) + if self.get_sys_airflow() == "FTOB" and sensor_name == "tmp75-i2c-7-4d": + input_name = "INLET_TEMP" + + if self.get_sys_airflow() == "BTOF" and sensor_name == "tmp75-i2c-39-48": + input_name = "INLET_TEMP" + + self.sensor_name = "TEMPERATURE" + + elif 'fancpld' in sensor_name: + raw_fan_input = input_name.split() + input_name = raw_fan_input[0] + \ + raw_fan_input[1] + "_" + raw_fan_input[2] + + elif 'ir35' in sensor_name or 'ir38' in sensor_name: + sensor_name_raw = sensor_name.split("-") + sensor_name = sensor_name_raw[0] + self.sensor_name = sensor_name.upper() + + return input_name.replace(" ", "_").upper() + + def get_num_sensors(self): + """ + Get the number of sensors + :return: int num_sensors + """ + + num_sensors = 0 + try: + # Request and validate sensor's information + self.sensor_info_list = self.request_data() + + # Get number of sensors. + num_sensors = len(self.sensor_info_list) + except: + print "Error: Unable to access sensor information" + return 0 + + return num_sensors + + def get_sensor_input_num(self, index): + """ + Get the number of the input items of the specified sensor + :return: int input_num + """ + + input_num = 0 + try: + # Request and validate sensor's information. + self.sensor_info_list = self.request_data() + + # Get sensor's input number. + sensor_data = self.sensor_info_list[index-1] + input_num = len(sensor_data.keys())-2 + except: + print "Error: Unable to access sensor information" + return 0 + + return input_num + + def get_sensor_name(self, index): + """ + Get the device name of the specified sensor. + for example "coretemp-isa-0000" + :return: str sensor_name + """ + + sensor_name = "N/A" + try: + # Request and validate sensor's information. + self.sensor_info_list = self.request_data() + + # Get sensor's name. + sensor_data = self.sensor_info_list[index-1] + sensor_name = sensor_data.get('name') + + except: + return "N/A" + + return sensor_name + + def get_sensor_input_name(self, sensor_index, input_index): + """ + Get the input item name of the specified input item of the + specified sensor index, for example "Physical id 0" + :return: str sensor_input_name + """ + + sensor_input_name = "N/A" + try: + # Request and validate sensor's information. + self.sensor_info_list = self.request_data() + sensor_data = self.sensor_info_list[sensor_index-1].copy() + + # Remove none input key. + del sensor_data["name"] + del sensor_data["Adapter"] + + # Get sensor's input name. + sensor_data_key = sensor_data.keys() + sensor_input_name = sensor_data_key[input_index-1] + except: + return "N/A" + + return sensor_input_name + + def get_sensor_input_type(self, sensor_index, input_index): + """ + Get the item type of the specified input item of the specified sensor index, + The return value should among "valtage","temperature" + :return: str sensor_input_type + """ + + sensor_input_type = "N/A" + try: + # Request and validate sensor's information. + self.sensor_info_list = self.request_data() + sensor_data = self.sensor_info_list[sensor_index-1].copy() + + # Remove none input key. + del sensor_data["name"] + del sensor_data["Adapter"] + + # Get sensor's input type name. + sensor_data_key = sensor_data.keys() + sensor_input_raw = sensor_data.get(sensor_data_key[input_index-1]) + sensor_data_str = sensor_input_raw.split() + sensor_input_type = self.input_type_selector(sensor_data_str[1]) + except: + return "N/A" + + return sensor_input_type + + def get_sensor_input_value(self, sensor_index, input_index): + """ + Get the current value of the input item, the unit is "V" or "C" + :return: float sensor_input_value + """ + + sensor_input_value = 0 + try: + # Request and validate sensor's information. + self.sensor_info_list = self.request_data() + sensor_data = self.sensor_info_list[sensor_index-1].copy() + + # Remove none input key. + del sensor_data["name"] + del sensor_data["Adapter"] + + # Get sensor's input value. + sensor_data_key = sensor_data.keys() + sensor_input_raw = sensor_data.get(sensor_data_key[input_index-1]) + sensor_data_str = sensor_input_raw.split() + sensor_input_value = float( + sensor_data_str[0]) if sensor_data_str[0] != "N/A" else 0 + except: + print "Error: Unable to access sensor information" + return 0 + + return sensor_input_value + + def get_sensor_input_low_threshold(self, sensor_index, input_index): + """ + Get the low threshold of the value, + the status of this item is not ok if the current value 1: + sensor_input_low_threshold = l_thres * \ + 1000 if str(unit[0]).lower() == 'k' else l_thres + except: + print "Error: Unable to access sensor information" + return 0 + + return sensor_input_low_threshold + + def get_sensor_input_high_threshold(self, sensor_index, input_index): + """ + Get the high threshold of the value, + the status of this item is not ok if the current value > high_threshold + :return: float sensor_input_high_threshold + """ + + sensor_input_high_threshold = 0 + try: + # Request and validate sensor's information. + self.sensor_info_list = self.request_data() + sensor_data = self.sensor_info_list[sensor_index-1].copy() + + # Remove none input key. + del sensor_data["name"] + del sensor_data["Adapter"] + + # Get sensor's input high threshold. + sensor_data_key = sensor_data.keys() + sensor_input_raw = sensor_data.get(sensor_data_key[input_index-1]) + sensor_data_str = sensor_input_raw.split() + indices = [i for i, s in enumerate( + sensor_data_str) if 'max' in s or 'high' in s] + h_thres = float( + sensor_data_str[indices[0] + 2]) if len(indices) != 0 else 0 + unit = sensor_data_str[indices[0] + + 3] if len(indices) != 0 else None + if unit is not None and len(unit) > 1: + sensor_input_high_threshold = h_thres * \ + 1000 if str(unit[0]).lower() == 'k' else h_thres + + except: + print "Error: Unable to access sensor information" + return 0 + + return sensor_input_high_threshold + + def get_sys_airflow(self): + sys_air_flow = "Unknown" + sys_pn_data = [ + v.split(":") for v in self.sys_fruid_list if "Product Part Number" in v] + + if len(sys_pn_data) == 0: + return sys_air_flow + + sys_pn = sys_pn_data[0][1] + if "R1241-F0001" in sys_pn: + sys_air_flow = "FTOB" + elif"R1241-F0002" in sys_pn: + sys_air_flow = "BTOF" + + return sys_air_flow + + def get_all(self): + + all_sensor_dict = dict() + + # Request sensor's information. + self.sensor_info_list = self.request_data() + for sensor_data in self.sensor_info_list: + sensor_info = sensor_data.copy() + + # Remove none unuse key. + del sensor_info["name"] + del sensor_info["Adapter"] + + # Set sensor data. + sensor_dict = dict() + + for k, v in sensor_info.items(): + sensor_i_dict = dict() + sensor_data_str = v.split() + indices_h = [i for i, s in enumerate( + sensor_data_str) if 'max' in s or 'high' in s] + indices_l = [i for i, s in enumerate( + sensor_data_str) if 'min' in s or 'low' in s] + h_thres = float( + sensor_data_str[indices_h[0] + 2]) if len(indices_h) != 0 else 0 + l_thres = float( + sensor_data_str[indices_l[0] + 2]) if len(indices_l) != 0 else 0 + thres_unit = sensor_data_str[-1] + + sensor_i_dict["Type"] = self.input_type_selector( + sensor_data_str[1]) + sensor_i_dict["Value"] = float( + sensor_data_str[0]) if sensor_data_str[0] != "N/A" else 0 + sensor_i_dict["HighThd"] = h_thres * \ + 1000 if str(thres_unit[0]).lower() == 'k' else h_thres + sensor_i_dict["LowThd"] = l_thres * \ + 1000 if str(thres_unit[0]).lower() == 'k' else l_thres + + k = self.input_name_selector(sensor_data.get('name'), k) + sensor_dict[k] = sensor_i_dict + + if all_sensor_dict.get(self.sensor_name) is None: + all_sensor_dict[self.sensor_name] = dict() + + all_sensor_dict[self.sensor_name].update(sensor_dict) + + sensor_dict = dict() + sensor_dict["Sys_AirFlow"] = self.get_sys_airflow() + all_sensor_dict["TEMPERATURE"].update(sensor_dict) + + return all_sensor_dict diff --git a/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/sfputil.py b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/sfputil.py new file mode 100755 index 000000000000..f7e53b35c94e --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/sfputil.py @@ -0,0 +1,246 @@ +#!/usr/bin/env python +# +# Platform-specific SFP transceiver interface for SONiC +# + +try: + import time + 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 + PORT_END = 56 + QSFP_PORT_START = 49 + QSFP_PORT_END = 56 + + EEPROM_OFFSET = 9 + PORT_INFO_PATH = '/sys/class/fishbone48_fpga' + + _port_name = "" + _port_to_eeprom_mapping = {} + _port_to_i2cbus_mapping = {} + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(self.QSFP_PORT_START, self.QSFP_PORT_END + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + @property + def port_to_i2cbus_mapping(self): + return self._port_to_i2cbus_mapping + + def get_port_name(self, port_num): + if port_num in self.qsfp_ports: + self._port_name = "QSFP" + str(port_num - self.QSFP_PORT_START + 1) + else: + self._port_name = "SFP" + str(port_num) + return self._port_name + + def get_eeprom_dom_raw(self, port_num): + if port_num in self.qsfp_ports: + # QSFP DOM EEPROM is also at addr 0x50 and thus also stored in eeprom_ifraw + return None + else: + # Read dom eeprom at addr 0x51 + return self._read_eeprom_devid(port_num, self.DOM_EEPROM_ADDR, 256) + + def __init__(self): + # Override port_to_eeprom_mapping for class initialization + eeprom_path = '/sys/bus/i2c/devices/i2c-{0}/{0}-0050/eeprom' + + for x in range(self.PORT_START, self.PORT_END+1): + self.port_to_i2cbus_mapping[x] = (x + self.EEPROM_OFFSET) + self.port_to_eeprom_mapping[x] = eeprom_path.format( + x + self.EEPROM_OFFSET) + SfpUtilBase.__init__(self) + + def _do_write_file(self, file_handle, offset, value): + file_handle.seek(offset) + file_handle.write(hex(value)) + file_handle.close() + + def get_presence(self, port_num): + + # Check for invalid port_num + if port_num not in range(self.port_start, self.port_end + 1): + return False + + # Get path for access port presence status + port_name = self.get_port_name(port_num) + sysfs_filename = "qsfp_modprs" if port_num in self.qsfp_ports else "sfp_modabs" + reg_path = "/".join([self.PORT_INFO_PATH, port_name, sysfs_filename]) + + # Read status + try: + reg_file = open(reg_path) + content = reg_file.readline().rstrip() + reg_value = int(content) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + # Module present is active low + if reg_value == 0: + return True + + return False + + def get_low_power_mode(self, port_num): + return NotImplementedError + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid QSFP port_num + if port_num not in self.qsfp_ports: + return False + + try: + port_name = self.get_port_name(port_num) + reg_file = open( + "/".join([self.PORT_INFO_PATH, port_name, "qsfp_lpmode"]), "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = hex(lpmode) + + reg_file.seek(0) + reg_file.write(content) + reg_file.close() + + return True + + def reset(self, port_num): + # Check for invalid QSFP port_num + if port_num not in self.qsfp_ports: + return False + + try: + port_name = self.get_port_name(port_num) + reg_file = open( + "/".join([self.PORT_INFO_PATH, port_name, "qsfp_reset"]), "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + # Convert our register value back to a hex string and write back + reg_file.seek(0) + reg_file.write(hex(0)) + reg_file.close() + + # Sleep 1 second to allow it to settle + time.sleep(1) + + # Flip the bit back high and write back to the register to take port out of reset + try: + reg_file = open( + "/".join([self.PORT_INFO_PATH, port_name, "qsfp_reset"]), "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_file.seek(0) + reg_file.write(hex(1)) + reg_file.close() + + return True + + def get_transceiver_change_event(self, timeout=0): + """ + TBD + """ + return NotImplementedError + + def tx_disable(self, port_num, disable): + """ + @param port_num index of physical port + @param disable, True -- disable port tx signal + False -- enable port tx signal + @return True when operation success, False on failure. + """ + TX_DISABLE_BYTE_OFFSET = 86 + if port_num not in range(self.port_start, self.port_end + 1) or type(disable) != bool: + return False + + # QSFP, set eeprom to disable tx + if port_num in self.qsfp_ports: + presence = self.get_presence(port_num) + if not presence: + return True + + disable = b'\x0f' if disable else b'\x00' + # open eeprom + try: + with open(self.port_to_eeprom_mapping[port_num], mode="wb", buffering=0) as sysfsfile: + sysfsfile.seek(TX_DISABLE_BYTE_OFFSET) + sysfsfile.write(bytearray(disable)) + except IOError: + return False + except: + return False + + # SFP, set tx_disable pin + else: + try: + disable = hex(1) if disable else hex(0) + port_name = self.get_port_name(port_num) + reg_file = open( + "/".join([self.PORT_INFO_PATH, port_name, "sfp_txdisable"]), "w") + reg_file.write(disable) + reg_file.close() + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + return True + + def reset_all(self): + result = True + port_sysfs_path = [] + for port in range(self.port_start, self.port_end+1): + if port not in self.qsfp_ports: + continue + + presence = self.get_presence(port) + if not presence: + continue + + try: + port_name = self.get_port_name(port) + sysfs_path = "/".join([self.PORT_INFO_PATH, + port_name, "qsfp_reset"]) + reg_file = open(sysfs_path, "w") + port_sysfs_path.append(sysfs_path) + except IOError as e: + result = False + continue + + self._do_write_file(reg_file, 0, 0) + + time.sleep(1) + + for sysfs_path in port_sysfs_path: + try: + reg_file = open(sysfs_path, "w") + except IOError as e: + result = False + continue + + self._do_write_file(reg_file, 0, 1) + + return result diff --git a/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/td3-as13-48f8h.config.bcm b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/td3-as13-48f8h.config.bcm new file mode 100644 index 000000000000..a49674bb82ec --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/td3-as13-48f8h.config.bcm @@ -0,0 +1,406 @@ +help_cli_enable=1 +ifp_inports_support_enable=1 +ipv6_lpm_128b_enable=0x1 +l2_mem_entries=32768 +l2xmsg_mode=1 +l3_max_ecmp_mode=1 +l3_mem_entries=16384 +lpm_scaling_enable=1 +max_vp_lags=0 +mem_cache_enable=0 +memlist_enable=1 +miim_intr_enable=0 +module_64ports=1 +oversubscribe_mode=1 +parity_enable=0 +serdes_lane_config_dfe=on +#serdes_fec_enable=1 +serdes_if_type_xe=13 +serdes_if_type_ce=14 +pbmp_gport_stack.0=0x0000000000000000000000000000000000000000000000000000000000000000 +#pbmp_xport_xe=0x48878787f8787808dfe1e0203e1e1e022 +pbmp_xport_xe=0x8808787f87808088221e1e1fe1e1e1fe + + +portmap_1.0=1:25 +portmap_2.0=2:25 +portmap_3.0=3:25 +portmap_4.0=4:25 +portmap_5.0=5:25 +portmap_6.0=6:25 +portmap_7.0=7:25 +portmap_8.0=8:25 +portmap_13.0=13:25 +portmap_14.0=14:25 +portmap_15.0=15:25 +portmap_16.0=16:25 +portmap_21.0=21:25 +portmap_22.0=22:25 +portmap_23.0=23:25 +portmap_24.0=24:25 +portmap_29.0=29:25 +portmap_30.0=30:25 +portmap_31.0=31:25 +portmap_32.0=32:25 +portmap_33.0=33:25 +portmap_34.0=34:25 +portmap_35.0=35:25 +portmap_36.0=36:25 +portmap_41.0=41:25 +portmap_42.0=42:25 +portmap_43.0=43:25 +portmap_44.0=44:25 +portmap_49.0=49:25 +portmap_50.0=50:25 +portmap_51.0=51:25 +portmap_52.0=52:25 +portmap_57.0=57:100 +portmap_61.0=61:100 +portmap_67.0=65:100 +portmap_71.0=69:100 +portmap_79.0=77:100 +portmap_87.0=85:25 +portmap_88.0=86:25 +portmap_89.0=87:25 +portmap_90.0=88:25 +portmap_95.0=93:25 +portmap_96.0=94:25 +portmap_97.0=95:25 +portmap_98.0=96:25 +portmap_99.0=97:25 +portmap_100.0=98:25 +portmap_101.0=99:25 +portmap_102.0=100:25 +portmap_107.0=105:25 +portmap_108.0=106:25 +portmap_109.0=107:25 +portmap_110.0=108:25 +portmap_115.0=113:100 +portmap_123.0=121:100 +portmap_127.0=125:100 + +phy_chain_tx_lane_map_physical{1.0}=0x0123 +phy_chain_rx_lane_map_physical{1.0}=0x1032 +phy_chain_tx_lane_map_physical{5.0}=0x0123 +phy_chain_rx_lane_map_physical{5.0}=0x1032 +phy_chain_tx_lane_map_physical{13.0}=0x0123 +phy_chain_rx_lane_map_physical{13.0}=0x1032 +phy_chain_tx_lane_map_physical{21.0}=0x0123 +phy_chain_rx_lane_map_physical{21.0}=0x1032 +phy_chain_tx_lane_map_physical{29.0}=0x0123 +phy_chain_rx_lane_map_physical{29.0}=0x1032 +phy_chain_tx_lane_map_physical{33.0}=0x0123 +phy_chain_rx_lane_map_physical{33.0}=0x1032 +phy_chain_tx_lane_map_physical{41.0}=0x0123 +phy_chain_rx_lane_map_physical{41.0}=0x1032 +phy_chain_tx_lane_map_physical{49.0}=0x0123 +phy_chain_rx_lane_map_physical{49.0}=0x1032 +phy_chain_tx_lane_map_physical{57.0}=0x2031 +phy_chain_rx_lane_map_physical{57.0}=0x1023 +phy_chain_tx_lane_map_physical{61.0}=0x1302 +phy_chain_rx_lane_map_physical{61.0}=0x0123 +phy_chain_tx_lane_map_physical{65.0}=0x3210 +phy_chain_rx_lane_map_physical{65.0}=0x3210 +phy_chain_tx_lane_map_physical{69.0}=0x0123 +phy_chain_rx_lane_map_physical{69.0}=0x3120 +phy_chain_tx_lane_map_physical{77.0}=0x1302 +phy_chain_rx_lane_map_physical{77.0}=0x2031 +phy_chain_tx_lane_map_physical{85.0}=0x3210 +phy_chain_rx_lane_map_physical{85.0}=0x2301 +phy_chain_tx_lane_map_physical{93.0}=0x3210 +phy_chain_rx_lane_map_physical{93.0}=0x2301 +phy_chain_tx_lane_map_physical{97.0}=0x3210 +phy_chain_rx_lane_map_physical{97.0}=0x2301 +phy_chain_tx_lane_map_physical{105.0}=0x3210 +phy_chain_rx_lane_map_physical{105.0}=0x2301 +phy_chain_tx_lane_map_physical{113.0}=0x0132 +phy_chain_rx_lane_map_physical{113.0}=0x3120 +phy_chain_tx_lane_map_physical{121.0}=0x2301 +phy_chain_rx_lane_map_physical{121.0}=0x1023 +phy_chain_tx_lane_map_physical{125.0}=0x3210 +phy_chain_rx_lane_map_physical{125.0}=0x2031 +phy_chain_tx_polarity_flip_physical{1.0}=0x0 +phy_chain_rx_polarity_flip_physical{1.0}=0x1 +phy_chain_tx_polarity_flip_physical{2.0}=0x1 +phy_chain_rx_polarity_flip_physical{2.0}=0x0 +phy_chain_tx_polarity_flip_physical{3.0}=0x0 +phy_chain_rx_polarity_flip_physical{3.0}=0x1 +phy_chain_tx_polarity_flip_physical{4.0}=0x1 +phy_chain_rx_polarity_flip_physical{4.0}=0x0 +phy_chain_tx_polarity_flip_physical{5.0}=0x0 +phy_chain_rx_polarity_flip_physical{5.0}=0x0 +phy_chain_tx_polarity_flip_physical{6.0}=0x1 +phy_chain_rx_polarity_flip_physical{6.0}=0x1 +phy_chain_tx_polarity_flip_physical{7.0}=0x0 +phy_chain_rx_polarity_flip_physical{7.0}=0x0 +phy_chain_tx_polarity_flip_physical{8.0}=0x1 +phy_chain_rx_polarity_flip_physical{8.0}=0x1 +phy_chain_tx_polarity_flip_physical{13.0}=0x0 +phy_chain_rx_polarity_flip_physical{13.0}=0x1 +phy_chain_tx_polarity_flip_physical{14.0}=0x1 +phy_chain_rx_polarity_flip_physical{14.0}=0x0 +phy_chain_tx_polarity_flip_physical{15.0}=0x0 +phy_chain_rx_polarity_flip_physical{15.0}=0x1 +phy_chain_tx_polarity_flip_physical{16.0}=0x1 +phy_chain_rx_polarity_flip_physical{16.0}=0x0 +phy_chain_tx_polarity_flip_physical{21.0}=0x0 +phy_chain_rx_polarity_flip_physical{21.0}=0x1 +phy_chain_tx_polarity_flip_physical{22.0}=0x1 +phy_chain_rx_polarity_flip_physical{22.0}=0x0 +phy_chain_tx_polarity_flip_physical{23.0}=0x0 +phy_chain_rx_polarity_flip_physical{23.0}=0x1 +phy_chain_tx_polarity_flip_physical{24.0}=0x1 +phy_chain_rx_polarity_flip_physical{24.0}=0x0 +phy_chain_tx_polarity_flip_physical{29.0}=0x0 +phy_chain_rx_polarity_flip_physical{29.0}=0x0 +phy_chain_tx_polarity_flip_physical{30.0}=0x1 +phy_chain_rx_polarity_flip_physical{30.0}=0x1 +phy_chain_tx_polarity_flip_physical{31.0}=0x0 +phy_chain_rx_polarity_flip_physical{31.0}=0x0 +phy_chain_tx_polarity_flip_physical{32.0}=0x1 +phy_chain_rx_polarity_flip_physical{32.0}=0x1 +phy_chain_tx_polarity_flip_physical{33.0}=0x0 +phy_chain_rx_polarity_flip_physical{33.0}=0x1 +phy_chain_tx_polarity_flip_physical{34.0}=0x1 +phy_chain_rx_polarity_flip_physical{34.0}=0x0 +phy_chain_tx_polarity_flip_physical{35.0}=0x0 +phy_chain_rx_polarity_flip_physical{35.0}=0x1 +phy_chain_tx_polarity_flip_physical{36.0}=0x1 +phy_chain_rx_polarity_flip_physical{36.0}=0x0 +phy_chain_tx_polarity_flip_physical{41.0}=0x0 +phy_chain_rx_polarity_flip_physical{41.0}=0x1 +phy_chain_tx_polarity_flip_physical{42.0}=0x1 +phy_chain_rx_polarity_flip_physical{42.0}=0x0 +phy_chain_tx_polarity_flip_physical{43.0}=0x0 +phy_chain_rx_polarity_flip_physical{43.0}=0x1 +phy_chain_tx_polarity_flip_physical{44.0}=0x1 +phy_chain_rx_polarity_flip_physical{44.0}=0x0 +phy_chain_tx_polarity_flip_physical{49.0}=0x0 +phy_chain_rx_polarity_flip_physical{49.0}=0x0 +phy_chain_tx_polarity_flip_physical{50.0}=0x0 +phy_chain_rx_polarity_flip_physical{50.0}=0x0 +phy_chain_tx_polarity_flip_physical{51.0}=0x1 +phy_chain_rx_polarity_flip_physical{51.0}=0x0 +phy_chain_tx_polarity_flip_physical{52.0}=0x0 +phy_chain_rx_polarity_flip_physical{52.0}=0x0 +phy_chain_tx_polarity_flip_physical{57.0}=0x0 +phy_chain_rx_polarity_flip_physical{57.0}=0x1 +phy_chain_tx_polarity_flip_physical{58.0}=0x0 +phy_chain_rx_polarity_flip_physical{58.0}=0x1 +phy_chain_tx_polarity_flip_physical{59.0}=0x0 +phy_chain_rx_polarity_flip_physical{59.0}=0x0 +phy_chain_tx_polarity_flip_physical{60.0}=0x1 +phy_chain_rx_polarity_flip_physical{60.0}=0x1 +phy_chain_tx_polarity_flip_physical{61.0}=0x0 +phy_chain_rx_polarity_flip_physical{61.0}=0x1 +phy_chain_tx_polarity_flip_physical{62.0}=0x0 +phy_chain_rx_polarity_flip_physical{62.0}=0x1 +phy_chain_tx_polarity_flip_physical{63.0}=0x1 +phy_chain_rx_polarity_flip_physical{63.0}=0x1 +phy_chain_tx_polarity_flip_physical{64.0}=0x1 +phy_chain_rx_polarity_flip_physical{64.0}=0x1 +phy_chain_tx_polarity_flip_physical{65.0}=0x1 +phy_chain_rx_polarity_flip_physical{65.0}=0x1 +phy_chain_tx_polarity_flip_physical{66.0}=0x1 +phy_chain_rx_polarity_flip_physical{66.0}=0x0 +phy_chain_tx_polarity_flip_physical{67.0}=0x1 +phy_chain_rx_polarity_flip_physical{67.0}=0x1 +phy_chain_tx_polarity_flip_physical{68.0}=0x0 +phy_chain_rx_polarity_flip_physical{68.0}=0x1 +phy_chain_tx_polarity_flip_physical{69.0}=0x0 +phy_chain_rx_polarity_flip_physical{69.0}=0x1 +phy_chain_tx_polarity_flip_physical{70.0}=0x0 +phy_chain_rx_polarity_flip_physical{70.0}=0x1 +phy_chain_tx_polarity_flip_physical{71.0}=0x1 +phy_chain_rx_polarity_flip_physical{71.0}=0x0 +phy_chain_tx_polarity_flip_physical{72.0}=0x0 +phy_chain_rx_polarity_flip_physical{72.0}=0x1 +phy_chain_tx_polarity_flip_physical{77.0}=0x0 +phy_chain_rx_polarity_flip_physical{77.0}=0x1 +phy_chain_tx_polarity_flip_physical{78.0}=0x0 +phy_chain_rx_polarity_flip_physical{78.0}=0x0 +phy_chain_tx_polarity_flip_physical{79.0}=0x0 +phy_chain_rx_polarity_flip_physical{79.0}=0x0 +phy_chain_tx_polarity_flip_physical{80.0}=0x1 +phy_chain_rx_polarity_flip_physical{80.0}=0x0 +phy_chain_tx_polarity_flip_physical{85.0}=0x1 +phy_chain_rx_polarity_flip_physical{85.0}=0x0 +phy_chain_tx_polarity_flip_physical{86.0}=0x0 +phy_chain_rx_polarity_flip_physical{86.0}=0x1 +phy_chain_tx_polarity_flip_physical{87.0}=0x1 +phy_chain_rx_polarity_flip_physical{87.0}=0x0 +phy_chain_tx_polarity_flip_physical{88.0}=0x0 +phy_chain_rx_polarity_flip_physical{88.0}=0x1 +phy_chain_tx_polarity_flip_physical{93.0}=0x1 +phy_chain_rx_polarity_flip_physical{93.0}=0x0 +phy_chain_tx_polarity_flip_physical{94.0}=0x0 +phy_chain_rx_polarity_flip_physical{94.0}=0x1 +phy_chain_tx_polarity_flip_physical{95.0}=0x1 +phy_chain_rx_polarity_flip_physical{95.0}=0x0 +phy_chain_tx_polarity_flip_physical{96.0}=0x0 +phy_chain_rx_polarity_flip_physical{96.0}=0x1 +phy_chain_tx_polarity_flip_physical{97.0}=0x1 +phy_chain_rx_polarity_flip_physical{97.0}=0x1 +phy_chain_tx_polarity_flip_physical{98.0}=0x0 +phy_chain_rx_polarity_flip_physical{98.0}=0x0 +phy_chain_tx_polarity_flip_physical{99.0}=0x1 +phy_chain_rx_polarity_flip_physical{99.0}=0x1 +phy_chain_tx_polarity_flip_physical{100.0}=0x0 +phy_chain_rx_polarity_flip_physical{100.0}=0x0 +phy_chain_tx_polarity_flip_physical{105.0}=0x1 +phy_chain_rx_polarity_flip_physical{105.0}=0x0 +phy_chain_tx_polarity_flip_physical{106.0}=0x0 +phy_chain_rx_polarity_flip_physical{106.0}=0x1 +phy_chain_tx_polarity_flip_physical{107.0}=0x1 +phy_chain_rx_polarity_flip_physical{107.0}=0x0 +phy_chain_tx_polarity_flip_physical{108.0}=0x0 +phy_chain_rx_polarity_flip_physical{108.0}=0x1 +phy_chain_tx_polarity_flip_physical{113.0}=0x1 +phy_chain_rx_polarity_flip_physical{113.0}=0x1 +phy_chain_tx_polarity_flip_physical{114.0}=0x1 +phy_chain_rx_polarity_flip_physical{114.0}=0x1 +phy_chain_tx_polarity_flip_physical{115.0}=0x0 +phy_chain_rx_polarity_flip_physical{115.0}=0x0 +phy_chain_tx_polarity_flip_physical{116.0}=0x0 +phy_chain_rx_polarity_flip_physical{116.0}=0x1 +phy_chain_tx_polarity_flip_physical{121.0}=0x1 +phy_chain_rx_polarity_flip_physical{121.0}=0x1 +phy_chain_tx_polarity_flip_physical{122.0}=0x0 +phy_chain_rx_polarity_flip_physical{122.0}=0x1 +phy_chain_tx_polarity_flip_physical{123.0}=0x0 +phy_chain_rx_polarity_flip_physical{123.0}=0x0 +phy_chain_tx_polarity_flip_physical{124.0}=0x0 +phy_chain_rx_polarity_flip_physical{124.0}=0x1 +phy_chain_tx_polarity_flip_physical{125.0}=0x0 +phy_chain_rx_polarity_flip_physical{125.0}=0x0 +phy_chain_tx_polarity_flip_physical{126.0}=0x0 +phy_chain_rx_polarity_flip_physical{126.0}=0x1 +phy_chain_tx_polarity_flip_physical{127.0}=0x1 +phy_chain_rx_polarity_flip_physical{127.0}=0x1 +phy_chain_tx_polarity_flip_physical{128.0}=0x0 +phy_chain_rx_polarity_flip_physical{128.0}=0x1 + + +dport_map_port_49=1 +dport_map_port_50=2 +dport_map_port_51=3 +dport_map_port_52=4 +dport_map_port_13=5 +dport_map_port_14=6 +dport_map_port_15=7 +dport_map_port_16=8 +dport_map_port_21=9 +dport_map_port_22=10 +dport_map_port_23=11 +dport_map_port_24=12 +dport_map_port_29=13 +dport_map_port_30=14 +dport_map_port_31=15 +dport_map_port_32=16 +dport_map_port_33=17 +dport_map_port_34=18 +dport_map_port_35=19 +dport_map_port_36=20 +dport_map_port_41=21 +dport_map_port_42=22 +dport_map_port_43=23 +dport_map_port_44=24 +dport_map_port_1=25 +dport_map_port_2=26 +dport_map_port_3=27 +dport_map_port_4=28 +dport_map_port_5=29 +dport_map_port_6=30 +dport_map_port_7=31 +dport_map_port_8=32 +dport_map_port_87=33 +dport_map_port_88=34 +dport_map_port_89=35 +dport_map_port_90=36 +dport_map_port_95=37 +dport_map_port_96=38 +dport_map_port_97=39 +dport_map_port_98=40 +dport_map_port_99=41 +dport_map_port_100=42 +dport_map_port_101=43 +dport_map_port_102=44 +dport_map_port_107=45 +dport_map_port_108=46 +dport_map_port_109=47 +dport_map_port_110=48 +dport_map_port_57=49 +dport_map_port_61=50 +dport_map_port_123=51 +dport_map_port_115=52 +dport_map_port_127=53 +dport_map_port_67=54 +dport_map_port_79=55 +dport_map_port_71=56 + +#Pre-emphasis configuration for optical module +# configuration for 25G optical module +serdes_preemphasis_49=0x134809 +serdes_preemphasis_50=0x124909 +serdes_preemphasis_51=0x124909 +serdes_preemphasis_52=0x124909 +serdes_preemphasis_13=0x124909 +serdes_preemphasis_14=0x124909 +serdes_preemphasis_15=0x124909 +serdes_preemphasis_16=0x124909 +serdes_preemphasis_21=0x104b09 +serdes_preemphasis_22=0x104b09 +serdes_preemphasis_23=0x0f4c09 +serdes_preemphasis_24=0x0f4c09 +serdes_preemphasis_29=0x0f4c09 +serdes_preemphasis_30=0x0f4c09 +serdes_preemphasis_31=0x0f4c09 +serdes_preemphasis_32=0x0e4d09 +serdes_preemphasis_33=0x0e4d09 +serdes_preemphasis_34=0x0c4f09 +serdes_preemphasis_35=0x0c4f09 +serdes_preemphasis_36=0x0c4f09 +serdes_preemphasis_41=0x0c4f09 +serdes_preemphasis_42=0x0c4f09 +serdes_preemphasis_43=0x0c4f09 +serdes_preemphasis_44=0x0c4f09 +serdes_preemphasis_1=0x0f4c09 +serdes_preemphasis_2=0x0f4c09 +serdes_preemphasis_3=0x0e4d09 +serdes_preemphasis_4=0x0f4c09 +serdes_preemphasis_5=0x0e4d09 +serdes_preemphasis_6=0x0e4d09 +serdes_preemphasis_7=0x0e4d09 +serdes_preemphasis_8=0x0e4d09 +serdes_preemphasis_87=0x0c4f09 +serdes_preemphasis_88=0x0c4f09 +serdes_preemphasis_89=0x0c4f09 +serdes_preemphasis_90=0x0c4f09 +serdes_preemphasis_95=0x0c4f09 +serdes_preemphasis_96=0x0c4f09 +serdes_preemphasis_97=0x0c4f09 +serdes_preemphasis_98=0x0c4f09 +serdes_preemphasis_99=0x0c4f09 +serdes_preemphasis_100=0x0e4d09 +serdes_preemphasis_101=0x0e4d09 +serdes_preemphasis_102=0x0f4c09 +serdes_preemphasis_107=0x0f4c09 +serdes_preemphasis_108=0x0f4c09 +serdes_preemphasis_109=0x0f4c09 +serdes_preemphasis_110=0x0f4c09 + +# configuration for 100G optical module +serdes_preemphasis_57=0x154708 +serdes_preemphasis_61=0x154708 +serdes_preemphasis_123=0x154708 +serdes_preemphasis_115=0x154708 +serdes_preemphasis_127=0x154708 +serdes_preemphasis_67=0x154708 +serdes_preemphasis_79=0x154708 +serdes_preemphasis_71=0x154708 + +reglist_enable=1 +scache_filename=/tmp/scache +schan_intr_enable=0 +stable_size=0x5500000 +tdma_timeout_usec=3000000 diff --git a/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/AS23-128H/port_config.ini b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/AS23-128H/port_config.ini new file mode 100644 index 000000000000..224418d2c15a --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/AS23-128H/port_config.ini @@ -0,0 +1,129 @@ +# name lanes alias index +Ethernet1 9,10 QSFP1 1 +Ethernet2 11,12 QSFP2 2 +Ethernet3 15,16 QSFP3 3 +Ethernet4 13,14 QSFP4 4 +Ethernet5 77,78 QSFP5 5 +Ethernet6 79,80 QSFP6 6 +Ethernet7 75,76 QSFP7 7 +Ethernet8 73,74 QSFP8 8 +Ethernet9 1,2 QSFP9 9 +Ethernet10 3,4 QSFP10 10 +Ethernet11 7,8 QSFP11 11 +Ethernet12 5,6 QSFP12 12 +Ethernet13 69,70 QSFP13 13 +Ethernet14 71,72 QSFP14 14 +Ethernet15 67,68 QSFP15 15 +Ethernet16 65,66 QSFP16 16 +Ethernet17 41,42 QSFP17 17 +Ethernet18 43,44 QSFP18 18 +Ethernet19 47,48 QSFP19 19 +Ethernet20 45,46 QSFP20 20 +Ethernet21 109,110 QSFP21 21 +Ethernet22 111,112 QSFP22 22 +Ethernet23 107,108 QSFP23 23 +Ethernet24 105,106 QSFP24 24 +Ethernet25 33,34 QSFP25 25 +Ethernet26 35,36 QSFP26 26 +Ethernet27 39,40 QSFP27 27 +Ethernet28 37,38 QSFP28 28 +Ethernet29 101,102 QSFP29 29 +Ethernet30 103,104 QSFP30 30 +Ethernet31 99,100 QSFP31 31 +Ethernet32 97,98 QSFP32 32 +Ethernet33 137,138 QSFP33 33 +Ethernet34 139,140 QSFP34 34 +Ethernet35 143,144 QSFP35 35 +Ethernet36 141,142 QSFP36 36 +Ethernet37 205,206 QSFP37 37 +Ethernet38 207,208 QSFP38 38 +Ethernet39 203,204 QSFP39 39 +Ethernet40 201,202 QSFP40 40 +Ethernet41 129,130 QSFP41 41 +Ethernet42 131,132 QSFP42 42 +Ethernet43 135,136 QSFP43 43 +Ethernet44 133,134 QSFP44 44 +Ethernet45 197,198 QSFP45 45 +Ethernet46 199,200 QSFP46 46 +Ethernet47 195,196 QSFP47 47 +Ethernet48 193,194 QSFP48 48 +Ethernet49 169,170 QSFP49 49 +Ethernet50 171,172 QSFP50 50 +Ethernet51 175,176 QSFP51 51 +Ethernet52 173,174 QSFP52 52 +Ethernet53 237,238 QSFP53 53 +Ethernet54 239,240 QSFP54 54 +Ethernet55 235,236 QSFP55 55 +Ethernet56 233,234 QSFP56 56 +Ethernet57 161,162 QSFP57 57 +Ethernet58 163,164 QSFP58 58 +Ethernet59 167,168 QSFP59 59 +Ethernet60 165,166 QSFP60 60 +Ethernet61 229,230 QSFP61 61 +Ethernet62 231,232 QSFP62 62 +Ethernet63 227,228 QSFP63 63 +Ethernet64 225,226 QSFP64 64 +Ethernet65 25,26 QSFP65 65 +Ethernet66 27,28 QSFP66 66 +Ethernet67 31,32 QSFP67 67 +Ethernet68 29,30 QSFP68 68 +Ethernet69 93,94 QSFP69 69 +Ethernet70 95,96 QSFP70 70 +Ethernet71 91,92 QSFP71 71 +Ethernet72 89,90 QSFP72 72 +Ethernet73 17,18 QSFP73 73 +Ethernet74 19,20 QSFP74 74 +Ethernet75 23,24 QSFP75 75 +Ethernet76 21,22 QSFP76 76 +Ethernet77 85,86 QSFP77 77 +Ethernet78 87,88 QSFP78 78 +Ethernet79 83,84 QSFP79 79 +Ethernet80 81,82 QSFP80 80 +Ethernet81 57,58 QSFP81 81 +Ethernet82 59,60 QSFP82 82 +Ethernet83 63,64 QSFP83 83 +Ethernet84 61,62 QSFP84 84 +Ethernet85 125,126 QSFP85 85 +Ethernet86 127,128 QSFP86 86 +Ethernet87 123,124 QSFP87 87 +Ethernet88 121,122 QSFP88 88 +Ethernet89 49,50 QSFP89 89 +Ethernet90 51,52 QSFP90 90 +Ethernet91 55,56 QSFP91 91 +Ethernet92 53,54 QSFP92 92 +Ethernet93 117,118 QSFP93 93 +Ethernet94 119,120 QSFP94 94 +Ethernet95 115,116 QSFP95 95 +Ethernet96 113,114 QSFP96 96 +Ethernet97 153,154 QSFP97 97 +Ethernet98 155,156 QSFP98 98 +Ethernet99 159,160 QSFP99 99 +Ethernet100 157,158 QSFP100 100 +Ethernet101 221,222 QSFP101 101 +Ethernet102 223,224 QSFP102 102 +Ethernet103 219,220 QSFP103 103 +Ethernet104 217,218 QSFP104 104 +Ethernet105 145,146 QSFP105 105 +Ethernet106 147,148 QSFP106 106 +Ethernet107 151,152 QSFP107 107 +Ethernet108 149,150 QSFP108 108 +Ethernet109 213,214 QSFP109 109 +Ethernet110 215,216 QSFP110 110 +Ethernet111 211,212 QSFP111 111 +Ethernet112 209,210 QSFP112 112 +Ethernet113 185,186 QSFP113 113 +Ethernet114 187,188 QSFP114 114 +Ethernet115 191,192 QSFP115 115 +Ethernet116 189,190 QSFP116 116 +Ethernet117 253,254 QSFP117 117 +Ethernet118 255,256 QSFP118 118 +Ethernet119 251,252 QSFP119 119 +Ethernet120 249,250 QSFP120 120 +Ethernet121 177,178 QSFP121 121 +Ethernet122 179,180 QSFP122 122 +Ethernet123 183,184 QSFP123 123 +Ethernet124 181,182 QSFP124 124 +Ethernet125 245,246 QSFP125 125 +Ethernet126 247,248 QSFP126 126 +Ethernet127 243,244 QSFP127 127 +Ethernet128 241,242 QSFP128 128 diff --git a/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/AS23-128H/sai.profile b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/AS23-128H/sai.profile new file mode 100644 index 000000000000..48e28001b167 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/AS23-128H/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/platform/th3-as23-128h.config.bcm diff --git a/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/custom_led.bin b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/custom_led.bin new file mode 100644 index 000000000000..a7f256cadee8 Binary files /dev/null and b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/custom_led.bin differ diff --git a/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/default_sku b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/default_sku new file mode 100644 index 000000000000..30e5af958eb9 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/default_sku @@ -0,0 +1 @@ +AS23-128H t1 \ No newline at end of file diff --git a/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/installer.conf b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/installer.conf new file mode 100644 index 000000000000..dc3cf67d19e7 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/installer.conf @@ -0,0 +1,2 @@ +CONSOLE_SPEED=9600 +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="processor.max_cstate=1 intel_idle.max_cstate=0" diff --git a/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/led_proc_init.soc b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/led_proc_init.soc new file mode 100644 index 000000000000..28cd4b9bc9f7 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/led_proc_init.soc @@ -0,0 +1,9 @@ +#Enable all ports +#port all en=1 +#sleep 6 +#linkscan 250000; port xe,ce linkscan=on + +#Load LED +#led auto on; led start + + diff --git a/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/linkscan_led_fw.bin b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/linkscan_led_fw.bin new file mode 100644 index 000000000000..c2fa94a2d8cb Binary files /dev/null and b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/linkscan_led_fw.bin differ diff --git a/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/minigraph.xml b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/minigraph.xml new file mode 100644 index 000000000000..48c0ee0127c3 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/minigraph.xml @@ -0,0 +1,1333 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + sonic + 10.0.0.32 + 1 + 180 + 60 + + + sonic + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + sonic + 10.0.0.34 + 1 + 180 + 60 + + + sonic + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + sonic + 10.0.0.36 + 1 + 180 + 60 + + + sonic + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + sonic + 10.0.0.38 + 1 + 180 + 60 + + + sonic + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + sonic + 10.0.0.40 + 1 + 180 + 60 + + + sonic + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + sonic + 10.0.0.42 + 1 + 180 + 60 + + + sonic + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + sonic + 10.0.0.44 + 1 + 180 + 60 + + + sonic + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + sonic + 10.0.0.46 + 1 + 180 + 60 + + + sonic + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + sonic + 10.0.0.48 + 1 + 180 + 60 + + + sonic + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + sonic + 10.0.0.50 + 1 + 180 + 60 + + + sonic + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + sonic + 10.0.0.52 + 1 + 180 + 60 + + + sonic + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + sonic + 10.0.0.54 + 1 + 180 + 60 + + + sonic + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + sonic + 10.0.0.56 + 1 + 180 + 60 + + + sonic + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + sonic + 10.0.0.58 + 1 + 180 + 60 + + + sonic + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + sonic + 10.0.0.60 + 1 + 180 + 60 + + + sonic + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + sonic + 10.0.0.62 + 1 + 180 + 60 + + + sonic + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + sonic + + +
10.0.0.33
+ + +
+ +
10.0.0.1
+ + +
+ +
10.0.0.35
+ + +
+ +
10.0.0.3
+ + +
+ +
10.0.0.37
+ + +
+ +
10.0.0.5
+ + +
+ +
10.0.0.39
+ + +
+ +
10.0.0.7
+ + +
+ +
10.0.0.41
+ + +
+ +
10.0.0.9
+ + +
+ +
10.0.0.43
+ + +
+ +
10.0.0.11
+ + +
+ +
10.0.0.45
+ + +
+ +
10.0.0.13
+ + +
+ +
10.0.0.47
+ + +
+ +
10.0.0.15
+ + +
+ +
10.0.0.49
+ + +
+ +
10.0.0.17
+ + +
+ +
10.0.0.51
+ + +
+ +
10.0.0.19
+ + +
+ +
10.0.0.53
+ + +
+ +
10.0.0.21
+ + +
+ +
10.0.0.55
+ + +
+ +
10.0.0.23
+ + +
+ +
10.0.0.57
+ + +
+ +
10.0.0.25
+ + +
+ +
10.0.0.59
+ + +
+ +
10.0.0.27
+ + +
+ +
10.0.0.61
+ + +
+ +
10.0.0.29
+ + +
+ +
10.0.0.63
+ + +
+ +
10.0.0.31
+ + +
+
+ +
+ + 64001 + ARISTA01T0 + + + + 65200 + ARISTA01T2 + + + + 64002 + ARISTA02T0 + + + + 65200 + ARISTA02T2 + + + + 64003 + ARISTA03T0 + + + + 65200 + ARISTA03T2 + + + + 64004 + ARISTA04T0 + + + + 65200 + ARISTA04T2 + + + + 64005 + ARISTA05T0 + + + + 65200 + ARISTA05T2 + + + + 64006 + ARISTA06T0 + + + + 65200 + ARISTA06T2 + + + + 64007 + ARISTA07T0 + + + + 65200 + ARISTA07T2 + + + + 64008 + ARISTA08T0 + + + + 65200 + ARISTA08T2 + + + + 64009 + ARISTA09T0 + + + + 65200 + ARISTA09T2 + + + + 64010 + ARISTA10T0 + + + + 65200 + ARISTA10T2 + + + + 64011 + ARISTA11T0 + + + + 65200 + ARISTA11T2 + + + + 64012 + ARISTA12T0 + + + + 65200 + ARISTA12T2 + + + + 64013 + ARISTA13T0 + + + + 65200 + ARISTA13T2 + + + + 64014 + ARISTA14T0 + + + + 65200 + ARISTA14T2 + + + + 64015 + ARISTA15T0 + + + + 65200 + ARISTA15T2 + + + + 64016 + ARISTA16T0 + + + + 65200 + ARISTA16T2 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + + + + + + sonic + + + + + + QSFP1 + 10.0.0.0/31 + + + + QSFP2 + 10.0.0.2/31 + + + + QSFP3 + 10.0.0.4/31 + + + + QSFP4 + 10.0.0.6/31 + + + + QSFP5 + 10.0.0.8/31 + + + + QSFP6 + 10.0.0.10/31 + + + + QSFP7 + 10.0.0.12/31 + + + + QSFP8 + 10.0.0.14/31 + + + + QSFP9 + 10.0.0.16/31 + + + + QSFP10 + 10.0.0.18/31 + + + + QSFP11 + 10.0.0.20/31 + + + + QSFP12 + 10.0.0.22/31 + + + + QSFP13 + 10.0.0.24/31 + + + + QSFP14 + 10.0.0.26/31 + + + + QSFP15 + 10.0.0.28/31 + + + + QSFP16 + 10.0.0.30/31 + + + + QSFP17 + 10.0.0.32/31 + + + + QSFP18 + 10.0.0.34/31 + + + + QSFP19 + 10.0.0.36/31 + + + + QSFP20 + 10.0.0.38/31 + + + + QSFP21 + 10.0.0.40/31 + + + + QSFP22 + 10.0.0.42/31 + + + + QSFP23 + 10.0.0.44/31 + + + + QSFP24 + 10.0.0.46/31 + + + + QSFP25 + 10.0.0.48/31 + + + + QSFP26 + 10.0.0.50/31 + + + + QSFP27 + 10.0.0.52/31 + + + + QSFP28 + 10.0.0.54/31 + + + + QSFP29 + 10.0.0.56/31 + + + + QSFP30 + 10.0.0.58/31 + + + + QSFP31 + 10.0.0.60/31 + + + + QSFP32 + 10.0.0.62/31 + + + + QSFP33 + 10.0.0.64/31 + + + + QSFP34 + 10.0.0.66/31 + + + + QSFP35 + 10.0.0.68/31 + + + + QSFP36 + 10.0.0.70/31 + + + + QSFP37 + 10.0.0.72/31 + + + + QSFP38 + 10.0.0.74/31 + + + + QSFP39 + 10.0.0.76/31 + + + + QSFP40 + 10.0.0.78/31 + + + + QSFP41 + 10.0.0.80/31 + + + + QSFP42 + 10.0.0.82/31 + + + + QSFP43 + 10.0.0.84/31 + + + + QSFP44 + 10.0.0.86/31 + + + + QSFP45 + 10.0.0.88/31 + + + + QSFP46 + 10.0.0.90/31 + + + + QSFP47 + 10.0.0.92/31 + + + + QSFP48 + 10.0.0.94/31 + + + + QSFP49 + 10.0.0.96/31 + + + + QSFP50 + 10.0.0.98/31 + + + + QSFP51 + 10.0.0.100/31 + + + + QSFP52 + 10.0.0.102/31 + + + + QSFP53 + 10.0.0.104/31 + + + + QSFP54 + 10.0.0.106/31 + + + + QSFP55 + 10.0.0.108/31 + + + + QSFP56 + 10.0.0.110/31 + + + + QSFP57 + 10.0.0.112/31 + + + + QSFP58 + 10.0.0.114/31 + + + + QSFP59 + 10.0.0.116/31 + + + + QSFP60 + 10.0.0.118/31 + + + + QSFP61 + 10.0.0.120/31 + + + + QSFP62 + 10.0.0.122/31 + + + + QSFP63 + 10.0.0.124/31 + + + + QSFP64 + 10.0.0.126/31 + + + + QSFP65 + 10.0.1.0/31 + + + + QSFP66 + 10.0.1.2/31 + + + + QSFP67 + 10.0.1.4/31 + + + + QSFP68 + 10.0.1.6/31 + + + + QSFP69 + 10.0.1.8/31 + + + + QSFP70 + 10.0.1.10/31 + + + + QSFP71 + 10.0.1.12/31 + + + + QSFP72 + 10.0.1.14/31 + + + + QSFP73 + 10.0.1.16/31 + + + + QSFP74 + 10.0.1.18/31 + + + + QSFP75 + 10.0.1.20/31 + + + + QSFP76 + 10.0.1.22/31 + + + + QSFP77 + 10.0.1.24/31 + + + + QSFP78 + 10.0.1.26/31 + + + + QSFP79 + 10.0.1.28/31 + + + + QSFP80 + 10.0.1.30/31 + + + + QSFP81 + 10.0.1.32/31 + + + + QSFP82 + 10.0.1.34/31 + + + + QSFP83 + 10.0.1.36/31 + + + + QSFP84 + 10.0.1.38/31 + + + + QSFP85 + 10.0.1.40/31 + + + + QSFP86 + 10.0.1.42/31 + + + + QSFP87 + 10.0.1.44/31 + + + + QSFP88 + 10.0.1.46/31 + + + + QSFP89 + 10.0.1.48/31 + + + + QSFP90 + 10.0.1.50/31 + + + + QSFP91 + 10.0.1.52/31 + + + + QSFP92 + 10.0.1.54/31 + + + + QSFP93 + 10.0.1.56/31 + + + + QSFP94 + 10.0.1.58/31 + + + + QSFP95 + 10.0.1.60/31 + + + + QSFP96 + 10.0.1.62/31 + + + + QSFP97 + 10.0.1.64/31 + + + + QSFP98 + 10.0.1.66/31 + + + + QSFP99 + 10.0.1.68/31 + + + + QSFP100 + 10.0.1.70/31 + + + + QSFP101 + 10.0.1.72/31 + + + + QSFP102 + 10.0.1.74/31 + + + + QSFP103 + 10.0.1.76/31 + + + + QSFP104 + 10.0.1.78/31 + + + + QSFP105 + 10.0.1.80/31 + + + + QSFP106 + 10.0.1.82/31 + + + + QSFP107 + 10.0.1.84/31 + + + + QSFP108 + 10.0.1.86/31 + + + + QSFP109 + 10.0.1.88/31 + + + + QSFP110 + 10.0.1.90/31 + + + + QSFP111 + 10.0.1.92/31 + + + + QSFP112 + 10.0.1.94/31 + + + + QSFP113 + 10.0.1.96/31 + + + + QSFP114 + 10.0.1.98/31 + + + + QSFP115 + 10.0.1.100/31 + + + + QSFP116 + 10.0.1.102/31 + + + + QSFP117 + 10.0.1.104/31 + + + + QSFP118 + 10.0.1.106/31 + + + + QSFP119 + 10.0.1.108/31 + + + + QSFP120 + 10.0.1.110/31 + + + + QSFP121 + 10.0.1.112/31 + + + + QSFP122 + 10.0.1.114/31 + + + + QSFP123 + 10.0.1.116/31 + + + + QSFP124 + 10.0.1.118/31 + + + + QSFP125 + 10.0.1.120/31 + + + + QSFP126 + 10.0.1.122/31 + + + + QSFP127 + 10.0.1.124/31 + + + + QSFP128 + 10.0.1.126/31 + + + + + + + + + + + + sonic + AS23-128H + + + + + + + sonic + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + ErspanDestinationIpv4 + + 2.2.2.2 + + + + + + + sonic + AS23-128H +
diff --git a/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/opennsl-postinit.cfg b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/opennsl-postinit.cfg new file mode 100644 index 000000000000..7008c14c0ffc --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/opennsl-postinit.cfg @@ -0,0 +1,3 @@ +linkscan 250000; port xe,ce linkscan=on +sleep 1 +led auto on; led start diff --git a/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/cputemputil.py b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/cputemputil.py new file mode 100644 index 000000000000..ac2589d044fd --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/cputemputil.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python + +# +# cputemputil.py +# +# Platform-specific CPU temperature Interface for SONiC +# + +__author__ = 'Wirut G.' +__license__ = "GPL" +__version__ = "0.1.0" +__status__ = "Development" + + +import subprocess +import requests + + +class CpuTempUtil(): + """Platform-specific CpuTempUtil class""" + + def __init__(self): + pass + + def get_cpu_temp(self): + + # Get list of temperature of CPU cores. + p = subprocess.Popen(['sensors', '-Au', 'coretemp-isa-0000'], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = p.communicate() + raw_data_list = out.splitlines() + temp_string_list = [i for i, s in enumerate( + raw_data_list) if '_input' in s] + tmp_list = [0] + + for temp_string in temp_string_list: + tmp_list.append(float(raw_data_list[temp_string].split(":")[1])) + + return tmp_list + + def get_max_cpu_tmp(self): + # Get maximum temperature from list of temperature of CPU cores. + return max(self.get_cpu_temp()) diff --git a/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/eeprom.py b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/eeprom.py new file mode 100644 index 000000000000..46559439061d --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/eeprom.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +############################################################################# +# Celestica PHALANX +# +# 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, e: + raise ImportError (str(e) + "- required module not found") + + +class board(eeprom_tlvinfo.TlvInfoDecoder): + + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/class/i2c-adapter/i2c-0/0-0056/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) + diff --git a/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/fanutil.py b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/fanutil.py new file mode 100644 index 000000000000..7c37088b927e --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/fanutil.py @@ -0,0 +1,309 @@ +#!/usr/bin/env python + +__author__ = 'Wirut G.' +__license__ = "GPL" +__version__ = "0.1.2" +__status__ = "Development" + +import requests +import re + + +class FanUtil(): + """Platform-specific FanUtil class""" + + def __init__(self): + + self.fan_fru_url = "http://240.1.1.1:8080/api/sys/fruid/fan" + self.sensor_url = "http://240.1.1.1:8080/api/sys/sensors" + self.fru_data_list = None + self.sensor_data_list = None + + def request_data(self): + # Reqest data from BMC if not exist. + if self.fru_data_list is None or self.sensor_data_list is None: + fru_data_req = requests.get(self.fan_fru_url) + sensor_data_req = requests.get(self.sensor_url) + fru_json = fru_data_req.json() + sensor_json = sensor_data_req.json() + self.fru_data_list = fru_json.get('Information') + self.sensor_data_list = sensor_json.get('Information') + return self.fru_data_list, self.sensor_data_list + + def name_to_index(self, fan_name): + # Get fan index from fan name + match = re.match(r"(FAN)([0-9]+)-(1|2)", fan_name, re.I) + fan_index = None + if match: + i_list = list(match.groups()) + fan_index = int(i_list[1])*2 - (int(i_list[2]) % 2) + return fan_index + + def get_num_fans(self): + """ + Get the number of fans + :return: int num_fans + """ + num_fans = 10 + + return num_fans + + def get_fan_speed(self, fan_name): + """ + Get the current speed of the fan, the unit is "RPM" + :return: int fan_speed + """ + + try: + # Get real fan index + index = self.name_to_index(fan_name) + + # Set key and index. + fan_speed = 0 + position_key = "Front" if index % 2 != 0 else "Rear" + index = int(round(float(index)/2)) + fan_key = "Fan " + str(index) + " " + position_key + + # Request and validate fan information. + self.fru_data_list, self.sensor_data_list = self.request_data() + + # Get fan's speed. + for sensor_data in self.sensor_data_list: + sensor_name = sensor_data.get('name') + if "fan" in str(sensor_name): + fan_data = sensor_data.get(fan_key) + fan_sp_list = map(int, re.findall(r'\d+', fan_data)) + fan_speed = fan_sp_list[0] + + except: + return 0 + + return fan_speed + + def get_fan_low_threshold(self, fan_name): + """ + Get the low speed threshold of the fan. + if the current speed < low speed threshold, + the status of the fan is not ok. + :return: int fan_low_threshold + """ + + try: + # Get real fan index + index = self.name_to_index(fan_name) + + # Set key and index. + fan_low_threshold = 0 + position_key = "Front" if index % 2 != 0 else "Rear" + index = int(round(float(index)/2)) + fan_key = "Fan " + str(index) + " " + position_key + + # Request and validate fan information. + self.fru_data_list, self.sensor_data_list = self.request_data() + + # Get fan's threshold. + for sensor_data in self.sensor_data_list: + sensor_name = sensor_data.get('name') + if "fan" in str(sensor_name): + fan_data = sensor_data.get(fan_key) + fan_sp_list = map(int, re.findall(r'\d+', fan_data)) + fan_low_threshold = fan_sp_list[1] + + except: + return "N/A" + + return fan_low_threshold + + def get_fan_high_threshold(self, fan_name): + """ + Get the hight speed threshold of the fan, + if the current speed > high speed threshold, + the status of the fan is not ok + :return: int fan_high_threshold + """ + + try: + # Get real fan index + index = self.name_to_index(fan_name) + + # Set key and index. + fan_high_threshold = 0 + position_key = "Front" if index % 2 != 0 else "Rear" + index = int(round(float(index)/2)) + fan_key = "Fan " + str(index) + " " + position_key + + # Request and validate fan information. + self.fru_data_list, self.sensor_data_list = self.request_data() + + # Get fan's threshold. + for sensor_data in self.sensor_data_list: + sensor_name = sensor_data.get('name') + if "fan" in str(sensor_name): + fan_data = sensor_data.get(fan_key) + fan_sp_list = map(int, re.findall(r'\d+', fan_data)) + fan_high_threshold = fan_sp_list[2] + + except: + return 0 + + return fan_high_threshold + + def get_fan_pn(self, fan_name): + """ + Get the product name of the fan + :return: str fan_pn + """ + + try: + # Get real fan index + index = self.name_to_index(fan_name) + + # Set key and index. + fan_pn = "N/A" + index = int(round(float(index)/2)) + fan_fru_key = "Fantray" + str(index) + + # Request and validate fan information. + self.fru_data_list, self.sensor_data_list = self.request_data() + + # Get fan's fru. + for fan_fru in self.fru_data_list: + matching_fan = [s for s in fan_fru if fan_fru_key in s] + if matching_fan: + pn = [s for s in fan_fru if "Part" in s] + fan_pn = pn[0].split()[4] + + except: + return "N/A" + + return fan_pn + + def get_fan_sn(self, fan_name): + """ + Get the serial number of the fan + :return: str fan_sn + """ + try: + # Get real fan index + index = self.name_to_index(fan_name) + + # Set key and index. + fan_sn = "N/A" + index = int(round(float(index)/2)) + fan_fru_key = "Fantray" + str(index) + + # Request and validate fan information. + self.fru_data_list, self.sensor_data_list = self.request_data() + + # Get fan's fru. + for fan_fru in self.fru_data_list: + matching_fan = [s for s in fan_fru if fan_fru_key in s] + if matching_fan: + serial = [s for s in fan_fru if "Serial" in s] + fan_sn = serial[0].split()[3] + + except: + return "N/A" + + return fan_sn + + def get_fans_name_list(self): + """ + Get list of fan name. + :return: list fan_names + """ + fan_names = [] + + # Get the number of fans + n_fan = self.get_num_fans() + + # Set fan name and add to the list. + for x in range(1, n_fan + 1): + f_index = int(round(float(x)/2)) + pos = 1 if x % 2 else 2 + fan_name = 'FAN{}_{}'.format(f_index, pos) + fan_names.append(fan_name) + + return fan_names + + def get_all(self): + """ + Get all information of system FANs, returns JSON objects in python 'DICT'. + Number, mandatory, max number of FAN, integer + FAN1_1, FAN1_2, ... mandatory, FAN name, string + Present, mandatory for each FAN, present status, boolean, True for present, False for NOT present, read directly from h/w + Running, conditional, if PRESENT is True, running status of the FAN, True for running, False for stopped, read directly from h/w + Speed, conditional, if PRESENT is True, real FAN speed, float, read directly from h/w + LowThd, conditional, if PRESENT is True, lower bound of FAN speed, float, read from h/w + HighThd, conditional, if PRESENT is True, upper bound of FAN speed, float, read from h/w + PN, conditional, if PRESENT is True, PN of the FAN, string + SN, conditional, if PRESENT is True, SN of the FAN, string) + """ + + self.fru_data_list, self.sensor_data_list = self.request_data() + all_fan_dict = dict() + + # Get the number of fans + n_fan = self.get_num_fans() + all_fan_dict["Number"] = n_fan + + # Set fan FRU data. + fan_fru_dict = dict() + fan_raw_idx = 1 + for fan_fru in self.fru_data_list: + fru_dict = dict() + fan_ps = False + + if len(fan_fru) == 0: + fan_idx = fan_raw_idx + fan_pn = "N/A" + fan_sn = "N/A" + else: + fan_key = fan_fru[0].split() + if str(fan_key[-1]).lower() == "absent": + fan_idx = int(re.findall('\d+', fan_key[0])[0]) + + else: + fan_idx = int(re.findall('\d+', fan_key[-1])[0]) + fan_ps = True + pn = [s for s in fan_fru if "Part" in s] + sn = [s for s in fan_fru if "Serial" in s] + fan_pn = pn[0].split( + ":")[-1].strip() if len(pn) > 0 else 'N/A' + fan_sn = sn[0].split( + ":")[-1].strip() if len(sn) > 0 else 'N/A' + + fru_dict["PN"] = "N/A" if not fan_pn or fan_pn == "" else fan_pn + fru_dict["SN"] = "N/A" if not fan_sn or fan_sn == "" else fan_sn + fru_dict["Present"] = fan_ps + fan_fru_dict[fan_idx] = fru_dict + fan_raw_idx += 1 + + # Set fan sensor data. + for sensor_data in self.sensor_data_list: + sensor_name = sensor_data.get('name') + if "fan" in str(sensor_name): + for x in range(1, n_fan + 1): + fan_dict = dict() + f_index = int(round(float(x)/2)) + pos = 1 if x % 2 else 2 + position_key = "Front" if x % 2 != 0 else "Rear" + fan_key = "Fan " + str(f_index) + " " + position_key + fan_data = sensor_data.get(fan_key) + fan_sp_list = map(int, re.findall(r'\d+', fan_data)) + fan_dict["Present"] = fan_fru_dict[f_index]["Present"] + if fan_dict["Present"] or fan_sp_list[0] > 0: + fan_dict["Present"] = True + fan_dict["Speed"] = fan_sp_list[0] + fan_dict["Running"] = True if fan_dict["Speed"] > 0 else False + fan_dict["LowThd"] = fan_sp_list[1] + fan_dict["HighThd"] = fan_sp_list[2] + fan_dict["PN"] = fan_fru_dict[f_index]["PN"] + fan_dict["SN"] = fan_fru_dict[f_index]["SN"] + fan_dict["AirFlow"] = "FTOB" if "R1240-G0009" in fan_dict["PN"] else "Unknown" + fan_dict["Status"] = True if fan_dict["AirFlow"] != "Unknown" else False + fan_name = 'FAN{}_{}'.format(f_index, pos) + all_fan_dict[fan_name] = fan_dict + break + + return all_fan_dict diff --git a/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/fwmgrutil.py b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/fwmgrutil.py new file mode 100644 index 000000000000..619aa7b173f3 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/fwmgrutil.py @@ -0,0 +1,882 @@ +# fwmgrutil.py +# +# Platform-specific firmware management interface for SONiC +# + +import subprocess +import requests +import os +import pexpect +import base64 +import time +import json +import logging +import ast +from datetime import datetime + +try: + from sonic_fwmgr.fwgmr_base import FwMgrUtilBase +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +class FwMgrUtil(FwMgrUtilBase): + + """Platform-specific FwMgrUtil class""" + + def __init__(self): + self.platform_name = "AS23128h" + self.onie_config_file = "/host/machine.conf" + self.bmc_info_url = "http://240.1.1.1:8080/api/sys/bmc" + self.bmc_raw_command_url = "http://240.1.1.1:8080/api/sys/raw" + self.fw_upgrade_url = "http://240.1.1.1:8080/api/sys/upgrade" + self.onie_config_file = "/host/machine.conf" + self.fw_upgrade_logger_path = "/var/log/fw_upgrade.log" + self.cpldb_version_path = "/sys/devices/platform/%s.cpldb/getreg" % self.platform_name + self.fpga_version_path = "/sys/devices/platform/%s.switchboard/FPGA/getreg" % self.platform_name + self.switchboard_cpld1_path = "/sys/devices/platform/%s.switchboard/CPLD1/getreg" % self.platform_name + self.switchboard_cpld2_path = "/sys/devices/platform/%s.switchboard/CPLD2/getreg" % self.platform_name + self.switchboard_cpld3_path = "/sys/devices/platform/%s.switchboard/CPLD3/getreg" % self.platform_name + self.switchboard_cpld4_path = "/sys/devices/platform/%s.switchboard/CPLD4/getreg" % self.platform_name + self.bmc_pwd_path = "/usr/local/etc/bmcpwd" + + def __get_register_value(self, path, register): + cmd = "echo {1} > {0}; cat {0}".format(path, register) + p = subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + raw_data, err = p.communicate() + if err is not '': + return 'None' + else: + return raw_data.strip() + + def __update_fw_upgrade_logger(self, header, message): + if not os.path.isfile(self.fw_upgrade_logger_path): + cmd = "sudo touch %s && sudo chmod +x %s" % ( + self.fw_upgrade_logger_path, self.fw_upgrade_logger_path) + subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + logging.basicConfig(filename=self.fw_upgrade_logger_path, + filemode='a', + format='%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s', + datefmt='%b %d %H:%M:%S', + level=logging.INFO) + + log_message = "%s : %s" % (header, message) + if header != "last_upgrade_result": + print(log_message) + return logging.info(log_message) + + def get_bmc_pass(self): + if os.path.exists(self.bmc_pwd_path): + with open(self.bmc_pwd_path) as file: + data = file.read() + + key = "bmc" + dec = [] + enc = base64.urlsafe_b64decode(data) + for i in range(len(enc)): + key_c = key[i % len(key)] + dec_c = chr((256 + ord(enc[i]) - ord(key_c)) % 256) + dec.append(dec_c) + return "".join(dec) + return False + + def get_bmc_version(self): + """Get BMC version from SONiC + :returns: version string + + """ + bmc_version = None + + bmc_version_key = "OpenBMC Version" + bmc_info_req = requests.get(self.bmc_info_url, timeout=60) + if bmc_info_req.status_code == 200: + bmc_info_json = bmc_info_req.json() + bmc_info = bmc_info_json.get('Information') + bmc_version = bmc_info.get(bmc_version_key) + return str(bmc_version) + + def upload_file_bmc(self, fw_path): + scp_command = 'sudo scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r %s root@240.1.1.1:/home/root/' % os.path.abspath( + fw_path) + child = pexpect.spawn(scp_command) + i = child.expect(["root@240.1.1.1's password:"], timeout=30) + bmc_pwd = self.get_bmc_pass() + if i == 0 and bmc_pwd: + child.sendline(bmc_pwd) + data = child.read() + print(data) + child.close + return os.path.isfile(fw_path) + return False + + def get_cpld_version(self): + """Get CPLD version from SONiC + :returns: dict like {'CPLD_1': version_string, 'CPLD_2': version_string} + """ + + CPLD_B = self.__get_register_value(self.cpldb_version_path, '0xA100') + CPLD_C = self.__get_register_value(self.cpldb_version_path, '0xA1E0') + CPLD_1 = self.__get_register_value(self.switchboard_cpld1_path, '0x00') + CPLD_2 = self.__get_register_value(self.switchboard_cpld2_path, '0x00') + CPLD_3 = self.__get_register_value(self.switchboard_cpld3_path, '0x00') + CPLD_4 = self.__get_register_value(self.switchboard_cpld4_path, '0x00') + + fan_cpld_key = "FanCPLD Version" + fan_cpld = None + bmc_info_req = requests.get(self.bmc_info_url) + if bmc_info_req.status_code == 200: + bmc_info_json = bmc_info_req.json() + bmc_info = bmc_info_json.get('Information') + fan_cpld = bmc_info.get(fan_cpld_key) + + CPLD_B = 'None' if CPLD_B is 'None' else "{}.{}".format( + int(CPLD_B[2], 16), int(CPLD_B[3], 16)) + CPLD_C = 'None' if CPLD_C is 'None' else "{}.{}".format( + int(CPLD_C[2], 16), int(CPLD_C[3], 16)) + CPLD_1 = 'None' if CPLD_1 is 'None' else "{}.{}".format( + int(CPLD_1[2], 16), int(CPLD_1[3], 16)) + CPLD_2 = 'None' if CPLD_2 is 'None' else "{}.{}".format( + int(CPLD_2[2], 16), int(CPLD_2[3], 16)) + CPLD_3 = 'None' if CPLD_3 is 'None' else "{}.{}".format( + int(CPLD_3[2], 16), int(CPLD_3[3], 16)) + CPLD_4 = 'None' if CPLD_4 is 'None' else "{}.{}".format( + int(CPLD_4[2], 16), int(CPLD_4[3], 16)) + FAN_CPLD = 'None' if fan_cpld is None else "{}.{}".format( + int(fan_cpld[0], 16), int(fan_cpld[1], 16)) + + cpld_version_dict = {} + cpld_version_dict.update({'CPLD_B': CPLD_B}) + cpld_version_dict.update({'CPLD_C': CPLD_C}) + cpld_version_dict.update({'CPLD_1': CPLD_1}) + cpld_version_dict.update({'CPLD_2': CPLD_2}) + cpld_version_dict.update({'CPLD_3': CPLD_3}) + cpld_version_dict.update({'CPLD_4': CPLD_4}) + cpld_version_dict.update({'CPLD_FAN': FAN_CPLD}) + + return cpld_version_dict + + def get_bios_version(self): + """Get BIOS version from SONiC + :returns: version string + + """ + bios_version = None + + p = subprocess.Popen( + ["sudo", "dmidecode", "-s", "bios-version"], stdout=subprocess.PIPE) + raw_data = str(p.communicate()[0]) + if raw_data == '': + return str(None) + raw_data_list = raw_data.split("\n") + bios_version = raw_data_list[0] if len( + raw_data_list) == 1 else raw_data_list[-2] + + return str(bios_version) + + def get_onie_version(self): + """Get ONiE version from SONiC + :returns: version string + + """ + onie_verison = None + + onie_version_keys = "onie_version" + onie_config_file = open(self.onie_config_file, "r") + for line in onie_config_file.readlines(): + if onie_version_keys in line: + onie_version_raw = line.split('=') + onie_verison = onie_version_raw[1].strip() + break + onie_config_file.close() + return str(onie_verison) + + def get_pcie_version(self): + """Get PCiE version from SONiC + :returns: version dict { "PCIE_FW_LOADER": "2.5", "PCIE_FW": "D102_08" } + + """ + cmd = "sudo bcmcmd 'pciephy fw version'" + p = subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + raw_data, err = p.communicate() + + pcie_version = dict() + pcie_version["PCIE_FW_LOADER"] = 'None' + pcie_version["PCIE_FW"] = 'None' + + if err == '': + lines = raw_data.split('\n') + for line in lines: + if 'PCIe FW loader' in line: + pcie_version["PCIE_FW_LOADER"] = line.split(':')[1].strip() + elif 'PCIe FW version' in line: + pcie_version["PCIE_FW"] = line.split(':')[1].strip() + return pcie_version + + def get_fpga_version(self): + """Get FPGA version from SONiC + :returns: version string + + """ + version = self.__get_register_value(self.fpga_version_path, '0x00') + if version is not 'None': + version = "{}.{}".format( + int(version[2:][:4], 16), int(version[2:][4:], 16)) + return str(version) + + def firmware_upgrade(self, fw_type, fw_path, fw_extra=None): + """ + @fw_type MANDATORY, firmware type, should be one of the strings: 'cpld', 'fpga', 'bios', 'bmc' + @fw_path MANDATORY, target firmware file + @fw_extra OPTIONAL, extra information string, + + for fw_type 'cpld' and 'fpga': it can be used to indicate specific cpld, such as 'cpld1', 'cpld2', ... + or 'cpld_fan_come_board', etc. If None, upgrade all CPLD/FPGA firmware. for fw_type 'bios' and 'bmc', + value should be one of 'master' or 'slave' or 'both' + """ + fw_type = fw_type.lower() + bmc_pwd = self.get_bmc_pass() + if not bmc_pwd and fw_type != "fpga": + self.__update_fw_upgrade_logger( + "fw_upgrade", "fail, message=BMC credential not found") + return False + + if fw_type == 'bmc': + self.__update_fw_upgrade_logger( + "bmc_upgrade", "start BMC upgrade") + # Copy BMC image file to BMC + fw_extra_str = str(fw_extra).lower() + last_fw_upgrade = ["BMC", fw_path, fw_extra_str, "FAILED"] + upload_file = self.upload_file_bmc(fw_path) + if not upload_file: + self.__update_fw_upgrade_logger( + "fw_upgrade", "fail, message=unable to upload BMC image to BMC") + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return False + + filename_w_ext = os.path.basename(fw_path) + json_data = dict() + json_data["path"] = "root@127.0.0.1:/home/root/%s" % filename_w_ext + json_data["password"] = bmc_pwd + + # Set flash type + current_bmc = self.get_running_bmc() + flash = fw_extra_str if fw_extra_str in [ + "master", "slave", "both"] else "both" + if fw_extra_str == "pingpong": + #flash = "master" if current_bmc == "slave" else "slave" + flash = "slave" + json_data["flash"] = flash + + # Install BMC + if flash == "both": + self.__update_fw_upgrade_logger( + "bmc_upgrade", "install BMC as master mode") + json_data["flash"] = "master" + r = requests.post(self.bmc_info_url, json=json_data) + if r.status_code != 200 or 'success' not in r.json().get('result'): + self.__update_fw_upgrade_logger( + "bmc_upgrade", "fail, message=BMC API report error code %d" % r.status_code) + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return False + json_data["flash"] = "slave" + + self.__update_fw_upgrade_logger( + "bmc_upgrade", "install BMC as %s mode" % json_data["flash"]) + r = requests.post(self.bmc_info_url, json=json_data) + if r.status_code == 200 and 'success' in r.json().get('result'): + if fw_extra_str == "pingpong": + flash = "master" if current_bmc == "slave" else "slave" + self.__update_fw_upgrade_logger( + "bmc_upgrade", "switch to boot from %s" % flash) + self.set_bmc_boot_flash(flash) + self.__update_fw_upgrade_logger( + "bmc_upgrade", "reboot BMC") + if not self.reboot_bmc(): + return False + else: + self.__update_fw_upgrade_logger( + "bmc_upgrade", "reboot BMC") + reboot_dict = {} + reboot_dict["reboot"] = "yes" + r = requests.post(self.bmc_info_url, json=reboot_dict) + last_fw_upgrade[3] = "DONE" + else: + self.__update_fw_upgrade_logger( + "bmc_upgrade", "fail, message=unable to install BMC image") + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return False + + self.__update_fw_upgrade_logger( + "bmc_upgrade", "done") + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return True + + elif fw_type == 'fpga': + last_fw_upgrade = ["FPGA", fw_path, None, "FAILED"] + self.__update_fw_upgrade_logger( + "fpga_upgrade", "start FPGA upgrade") + + if not os.path.isfile(fw_path): + self.__update_fw_upgrade_logger( + "fpga_upgrade", "fail, message=FPGA image not found %s" % fw_path) + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return False + + command = 'fpga_prog ' + fw_path + print("Running command : %s" % command) + process = subprocess.Popen( + command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + while True: + output = process.stdout.readline() + if output == '' and process.poll() is not None: + break + + rc = process.returncode + if rc != 0: + self.__update_fw_upgrade_logger( + "fw_upgrade", "fail, message=unable to install FPGA") + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return False + + self.__update_fw_upgrade_logger("fpga_upgrade", "done") + last_fw_upgrade[3] = "DONE" + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + self.firmware_refresh(["FPGA"], None, None) + return True + + elif 'cpld' in fw_type: + self.__update_fw_upgrade_logger( + "cpld_upgrade", "start CPLD upgrade") + # Check input + fw_extra_str = str(fw_extra).upper() + if ":" in fw_path and ":" in fw_extra_str: + fw_path_list = fw_path.split(":") + fw_extra_str_list = fw_extra_str.split(":") + else: + fw_path_list = [fw_path] + fw_extra_str_list = [fw_extra_str] + + if len(fw_path_list) != len(fw_extra_str_list): + self.__update_fw_upgrade_logger( + "cpld_upgrade", "fail, message=invalid input") + return False + + data_list = list(zip(fw_path_list, fw_extra_str_list)) + refresh_img_path = None + cpld_result_list = ["FAILED" for i in range( + 0, len(fw_extra_str_list))] + last_fw_upgrade = ["CPLD", ":".join( + fw_path_list), ":".join(fw_extra_str_list), ":".join(cpld_result_list)] + for i in range(0, len(data_list)): + data = data_list[i] + fw_path = data[0] + fw_extra_str = data[1] + + # Set fw_extra + fw_extra_str = { + "TOP_LC_CPLD": "top_lc", + "BOT_LC_CPLD": "bottom_lc", + "FAN_CPLD": "fan", + "CPU_CPLD": "cpu", + "BASE_CPLD": "base", + "COMBO_CPLD": "combo", + "SW_CPLD1": "switch", + "SW_CPLD2": "switch", + "REFRESH_CPLD": "refresh" + }.get(fw_extra_str, None) + + if fw_extra_str == "refresh": + refresh_img_path = fw_path + del cpld_result_list[i] + del fw_extra_str_list[i] + continue + + if fw_extra_str is None: + self.__update_fw_upgrade_logger( + "cpld_upgrade", "fail, message=invalid extra information string") + continue + + # Uploading image to BMC + self.__update_fw_upgrade_logger( + "cpld_upgrade", "start %s upgrade" % data[1]) + upload_file = self.upload_file_bmc(fw_path) + if not upload_file: + self.__update_fw_upgrade_logger( + "cpld_upgrade", "fail, message=unable to upload BMC image to BMC") + continue + + filename_w_ext = os.path.basename(fw_path) + json_data = dict() + json_data["image_path"] = "root@127.0.0.1:/home/root/%s" % filename_w_ext + json_data["password"] = bmc_pwd + json_data["device"] = "cpld" + json_data["reboot"] = "no" + json_data["type"] = fw_extra_str + + # Call BMC api to install cpld image + print("Installing...") + r = requests.post(self.fw_upgrade_url, json=json_data) + if r.status_code != 200 or 'success' not in r.json().get('result'): + self.__update_fw_upgrade_logger( + "cpld_upgrade", "fail, message=invalid cpld image") + continue + + cpld_result_list[i] = "DONE" + self.__update_fw_upgrade_logger( + "cpld_upgrade", "%s upgrade done" % data[1]) + last_fw_upgrade[3] = ":".join(cpld_result_list) + self.__update_fw_upgrade_logger( + "cpld_upgrade", "done") + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + + # Refresh CPLD + refresh_img_str_list = [] + for fw_extra in fw_extra_str_list: + if "BASE_CPLD" in fw_extra or "FAN_CPLD" in fw_extra: + refresh_img_str_list.append(refresh_img_path) + else: + refresh_img_str_list.append("None") + self.firmware_refresh(None, fw_extra_str_list, + ":".join(refresh_img_str_list)) + + return True + + elif 'bios' in fw_type: + self.__update_fw_upgrade_logger( + "bios_upgrade", "start BIOS upgrade") + last_fw_upgrade = ["BIOS", fw_path, None, "FAILED"] + fw_extra_str = str(fw_extra).lower() + flash = fw_extra_str if fw_extra_str in [ + "master", "slave"] else "master" + + if not os.path.exists(fw_path): + self.__update_fw_upgrade_logger( + "bios_upgrade", "fail, message=image not found") + return False + + scp_command = 'sudo scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r %s root@240.1.1.1:/home/root/' % os.path.abspath( + fw_path) + child = pexpect.spawn(scp_command) + i = child.expect(["root@240.1.1.1's password:"], timeout=30) + if i != 0: + self.__update_fw_upgrade_logger( + "bios_upgrade", "fail, message=unable to upload image to BMC") + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return False + + child.sendline(bmc_pwd) + data = child.read() + print(data) + child.close + + json_data = dict() + json_data["data"] = "/usr/bin/ipmitool -b 1 -t 0x2c raw 0x2e 0xdf 0x57 0x01 0x00 0x01" + r = requests.post(self.bmc_raw_command_url, json=json_data) + if r.status_code != 200: + self.__update_fw_upgrade_logger( + "bios_upgrade", "fail, message=unable to set state") + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return False + + filename_w_ext = os.path.basename(fw_path) + json_data = dict() + json_data["image_path"] = "root@127.0.0.1:/home/root/%s" % filename_w_ext + json_data["password"] = bmc_pwd + json_data["device"] = "bios" + json_data["flash"] = flash + json_data["reboot"] = "no" + + print("Installing...") + r = requests.post(self.fw_upgrade_url, json=json_data) + if r.status_code != 200 or 'success' not in r.json().get('result'): + self.__update_fw_upgrade_logger( + "bios_upgrade", "fail, message=unable install bios") + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return False + + last_fw_upgrade[3] = "DONE" + self.__update_fw_upgrade_logger( + "bios_upgrade", "done") + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + else: + self.__update_fw_upgrade_logger( + "fw_upgrade", "fail, message=invalid firmware type") + return False + + return True + + def get_last_upgrade_result(self): + """ + Get last firmware upgrade information, inlcudes: + 1) FwType: cpld/fpga/bios/bmc(passed by method 'firmware_upgrade'), string + 2) FwPath: path and file name of firmware(passed by method 'firmware_upgrade'), string + 3) FwExtra: designated string, econdings of this string is determined by vendor(passed by method 'firmware_program') + 4) Result: indicates whether the upgrade action is performed and success/failure status if performed. Values should be one of: "DONE"/"FAILED"/"NOT_PERFORMED". + list of object: + [ + { + "FwType": "cpld", + "FwPath": "cpu_cpld.vme" + "FwExtra":"CPU_CPLD" + "Result": "DONE" + }, + { + "FwType": "cpld", + "FwPath": "fan_cpld.vme" + "FwExtra": "FAN_CPLD" + "Result": "FAILED" + } + ] + """ + last_update_list = [] + + if os.path.exists(self.fw_upgrade_logger_path): + with open(self.fw_upgrade_logger_path, 'r') as file: + lines = file.read().splitlines() + + upgrade_txt = [i for i in reversed( + lines) if "last_upgrade_result" in i] + if len(upgrade_txt) > 0: + last_upgrade_txt = upgrade_txt[0].split( + "last_upgrade_result : ") + last_upgrade_list = ast.literal_eval(last_upgrade_txt[1]) + for x in range(0, len(last_upgrade_list[1].split(":"))): + upgrade_dict = {} + upgrade_dict["FwType"] = last_upgrade_list[0].lower() + upgrade_dict["FwPath"] = last_upgrade_list[1].split(":")[x] + upgrade_dict["FwExtra"] = last_upgrade_list[2].split(":")[ + x] if last_upgrade_list[2] else "None" + upgrade_dict["Result"] = last_upgrade_list[3].split(":")[x] + last_update_list.append(upgrade_dict) + + return last_update_list + + def firmware_program(self, fw_type, fw_path, fw_extra=None): + """ + Program FPGA and/or CPLD firmware only, but do not refresh them + + @param fw_type value can be: FPGA, CPLD + @param fw_path a string of firmware file path, seperated by ':', it should + match the sequence of param @fw_type + @param fw_extra a string of firmware subtype, i.e CPU_CPLD, BOARD_CPLD, + FAN_CPLD, LC_CPLD, etc. Subtypes are seperated by ':' + @return True when all required firmware is program succefully, + False otherwise. + + Example: + self.firmware_program("CPLD", "/cpu_cpld.vme:/lc_cpld", \ + "CPU_CPLD:LC_CPLD") + or + self.firmware_program("FPGA", "/fpga.bin") + """ + fw_type = fw_type.lower() + bmc_pwd = self.get_bmc_pass() + if not bmc_pwd and fw_type != "fpga": + self.__update_fw_upgrade_logger( + "fw_upgrade", "fail, message=BMC credential not found") + return False + + if fw_type == 'fpga': + last_fw_upgrade = ["FPGA", fw_path, None, "FAILED"] + self.__update_fw_upgrade_logger( + "fpga_upgrade", "start FPGA upgrade") + + if not os.path.isfile(fw_path): + self.__update_fw_upgrade_logger( + "fpga_upgrade", "fail, message=FPGA image not found %s" % fw_path) + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return False + + command = 'fpga_prog ' + fw_path + print("Running command: %s" % command) + process = subprocess.Popen( + command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + while True: + output = process.stdout.readline() + if output == '' and process.poll() is not None: + break + + rc = process.returncode + if rc != 0: + self.__update_fw_upgrade_logger( + "fw_upgrade", "fail, message=Unable to install FPGA") + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return False + + self.__update_fw_upgrade_logger("fpga_upgrade", "done") + last_fw_upgrade[3] = "DONE" + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return True + + elif 'cpld' in fw_type: + self.__update_fw_upgrade_logger( + "cpld_upgrade", "start CPLD upgrade") + + # Check input + fw_extra_str = str(fw_extra).upper() + if ":" in fw_path and ":" in fw_extra_str: + fw_path_list = fw_path.split(":") + fw_extra_str_list = fw_extra_str.split(":") + else: + fw_path_list = [fw_path] + fw_extra_str_list = [fw_extra_str] + + if len(fw_path_list) != len(fw_extra_str_list): + self.__update_fw_upgrade_logger( + "cpld_upgrade", "fail, message=Invalid input") + return False + + cpld_result_list = [] + data_list = list(zip(fw_path_list, fw_extra_str_list)) + for data in data_list: + fw_path = data[0] + fw_extra_str = data[1] + + # Set fw_extra + fw_extra_str = { + "TOP_LC_CPLD": "top_lc", + "BOT_LC_CPLD": "bottom_lc", + "FAN_CPLD": "fan", + "CPU_CPLD": "cpu", + "BASE_CPLD": "base", + "COMBO_CPLD": "combo", + "SW_CPLD1": "switch", + "SW_CPLD2": "switch" + }.get(fw_extra_str, None) + + self.__update_fw_upgrade_logger( + "cpld_upgrade", "start %s upgrade" % data[1]) + upgrade_result = "FAILED" + for x in range(1, 4): + # Set fw_extra + if x > 1: + self.__update_fw_upgrade_logger( + "cpld_upgrade", "fail, message=Retry to upgrade %s" % data[1]) + + elif fw_extra_str is None: + self.__update_fw_upgrade_logger( + "cpld_upgrade", "fail, message=Invalid extra information string %s" % data[1]) + break + elif not os.path.isfile(os.path.abspath(fw_path)): + self.__update_fw_upgrade_logger( + "cpld_upgrade", "fail, message=CPLD image not found %s" % fw_path) + break + + # Install cpld image via ispvm tool + print("Installing...") + command = 'ispvm %s' % fw_path + if fw_extra_str in ["top_lc", "bottom_lc"]: + option = 1 if fw_extra_str == "top_lc" else 2 + command = "ispvm -c %d %s" % (option, + os.path.abspath(fw_path)) + print("Running command : %s" % command) + process = subprocess.Popen( + command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + while True: + output = process.stdout.readline() + if output == '' and process.poll() is not None: + break + + rc = process.returncode + if rc != 0: + self.__update_fw_upgrade_logger( + "cpld_upgrade", "fail, message=Unable to install CPLD") + continue + + upgrade_result = "DONE" + self.__update_fw_upgrade_logger("cpld_upgrade", "done") + break + cpld_result_list.append(upgrade_result) + + last_fw_upgrade = ["CPLD", ":".join( + fw_path_list), ":".join(fw_extra_str_list), ":".join(cpld_result_list)] + self.__update_fw_upgrade_logger( + "last_upgrade_result", str(last_fw_upgrade)) + return "FAILED" not in cpld_result_list + else: + self.__update_fw_upgrade_logger( + "fw_upgrade", "fail, message=Invalid firmware type") + return False + + return True + + def firmware_refresh(self, fpga_list, cpld_list, fw_extra=None): + """ + Refresh firmware and take extra action when necessary. + @param fpga_list a list of FPGA names + @param cpld_list a list of CPLD names + @return True if refresh succefully and no power cycle action is taken. + + @Note extra action should be: power cycle the whole system(except BMC) when + CPU_CPLD or BOARD_CPLD or FPGA is refreshed. + No operation if the power cycle is not needed. + + Example: + self.firmware_refresh( + ["FPGA"], ["BASE_CPLD", "LC_CPLD"],"/tmp/fw/refresh.vme") + or + self.firmware_refresh(["FPGA"], None, None) + or + self.firmware_refresh(None, ["FAN_CPLD", "LC1_CPLD", "BASE_CPLD"], + "/tmp/fw/fan_refresh.vme:none:/tmp/fw/base_refresh.vme") + """ + + if not fpga_list and not cpld_list: + return False + + if type(cpld_list) is list and ("BASE_CPLD" in cpld_list or "FAN_CPLD" in cpld_list): + refresh_list = fpga_list + \ + cpld_list if type(fpga_list) is list else cpld_list + self.__update_fw_upgrade_logger( + "fw_refresh", "start %s refresh" % ",".join(refresh_list)) + fw_path_list = fw_extra.split(':') + command = "echo " + if len(fw_path_list) != len(cpld_list): + self.__update_fw_upgrade_logger( + "cpld_refresh", "fail, message=Invalid fw_extra") + return False + + for idx in range(0, len(cpld_list)): + fw_path = fw_path_list[idx] + refresh_type = { + "BASE_CPLD": "base", + "FAN_CPLD": "fan" + }.get(cpld_list[idx], None) + + if not refresh_type: + continue + elif not self.upload_file_bmc(fw_path): + self.__update_fw_upgrade_logger( + "cpld_refresh", "fail, message=Unable to upload refresh image to BMC") + return False + else: + filename_w_ext = os.path.basename(fw_path) + + sub_command = "%s /home/root/%s > /tmp/cpld_refresh " % ( + refresh_type, filename_w_ext) + command += sub_command + + json_data = dict() + json_data["data"] = command + r = requests.post(self.bmc_raw_command_url, json=json_data) + if r.status_code != 200: + self.__update_fw_upgrade_logger( + "cpld_refresh", "fail, message=%d Invalid refresh image" % r.status_code) + return False + elif type(cpld_list) is list: + refresh_list = fpga_list + \ + cpld_list if type(fpga_list) is list else cpld_list + self.__update_fw_upgrade_logger( + "fw_refresh", "start %s refresh" % ",".join(refresh_list)) + json_data = dict() + json_data["data"] = "echo cpu_cpld > /tmp/cpld_refresh" + r = requests.post(self.bmc_raw_command_url, json=json_data) + if r.status_code != 200: + self.__update_fw_upgrade_logger( + "cpld_refresh", "fail, message=%d Unable to load new CPLD" % r.status_code) + return False + elif type(fpga_list) is list: + self.__update_fw_upgrade_logger( + "fw_refresh", "start FPGA refresh") + json_data = dict() + json_data["data"] = "echo fpga > /tmp/cpld_refresh" + r = requests.post(self.bmc_raw_command_url, json=json_data) + if r.status_code != 200: + self.__update_fw_upgrade_logger( + "cpld_refresh", "fail, message=%d Unable to load new FPGA" % r.status_code) + return False + else: + self.__update_fw_upgrade_logger( + "fw_refresh", "fail, message=Invalid input") + return False + + self.__update_fw_upgrade_logger("fw_refresh", "done") + return True + + def get_running_bmc(self): + """ + Get booting flash of running BMC. + @return a string, "master" or "slave" + """ + json_data = dict() + json_data["data"] = "/usr/local/bin/boot_info.sh" + r = requests.post(self.bmc_raw_command_url, json=json_data) + try: + boot_info_list = r.json().get('result') + for boot_info_raw in boot_info_list: + boot_info = boot_info_raw.split(":") + if "Current Boot Code Source" in boot_info[0]: + flash = "master" if "master "in boot_info[1].lower( + ) else "slave" + return flash + raise Exception( + "Error: Unable to detect booting flash of running BMC") + except Exception as e: + raise Exception(e) + + def set_bmc_boot_flash(self, flash): + """ + Set booting flash of BMC + @param flash should be "master" or "slave" + """ + if flash.lower() not in ["master", "slave"]: + return False + json_data = dict() + json_data["data"] = "source /usr/local/bin/openbmc-utils.sh;bmc_reboot %s" % flash + r = requests.post(self.bmc_raw_command_url, json=json_data) + if r.status_code != 200: + return False + return True + + def reboot_bmc(self): + """ + Reboot BMC + """ + json_data = dict() + json_data["data"] = "source /usr/local/bin/openbmc-utils.sh;bmc_reboot reboot" + r = requests.post(self.bmc_raw_command_url, json=json_data) + if r.status_code != 200: + return False + return True + + def get_current_bios(self): + """ + # Get booting bios image of current running host OS + # @return a string, "master" or "slave" + """ + json_data = dict() + json_data["data"] = "source /usr/local/bin/openbmc-utils.sh;come_boot_info" + r = requests.post(self.bmc_raw_command_url, json=json_data) + try: + cpu_boot_info_list = r.json().get('result') + for cpu_boot_info_raw in cpu_boot_info_list: + if "COMe CPU boots from BIOS" in cpu_boot_info_raw: + bios_image = "master" if "master "in cpu_boot_info_raw.lower( + ) else "slave" + return bios_image + raise Exception( + "Error: Unable to detect current running bios image") + except Exception as e: + raise Exception(e) diff --git a/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/optictemputil.py b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/optictemputil.py new file mode 100644 index 000000000000..0e5b6a1c7109 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/optictemputil.py @@ -0,0 +1,126 @@ +#!/usr/bin/env python + +# +# optictemputil.py +# +# Platform-specific Optic module temperature Interface for SONiC +# + +__author__ = 'Pradchaya P.' +__author__ = 'Wirut G.' +__license__ = "GPL" +__version__ = "1.0.0" +__status__ = "Development" + +import os +import sys +import binascii +import subprocess + +class OpticTempUtil(): + """Platform-specific OpticTempUtil class""" + + def __init__(self): + pass + + def read_eeprom_specific_bytes(self, sysfsfile_eeprom, offset, num_bytes): + eeprom_raw = [] + for i in range(0, num_bytes): + eeprom_raw.append("0x00") + + try: + sysfsfile_eeprom.seek(offset) + raw = sysfsfile_eeprom.read(num_bytes) + except IOError: + return None + + try: + for n in range(0, num_bytes): + eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) + except: + return None + + return eeprom_raw + + + def twos_comp(self, num, bits): + try: + if ((num & (1 << (bits - 1))) != 0): + num = num - (1 << bits) + return num + except: + return 0 + + + def calc_temperature(self, cal_type, eeprom_data, offset, size): + + msb = int(eeprom_data[offset], 16) + lsb = int(eeprom_data[offset + 1], 16) + + result = (msb << 8) | (lsb & 0xff) + result = self.twos_comp(result, 16) + + if cal_type == 1: + # Internal calibration + result = float(result / 256.0) + retval = '%.4f' %result + + # TODO: Should support external calibration in future. + else: + retval = 0 + + return retval + + ''' TODO: Change busnum to sysfs_sfp_i2c_client_eeprom_path from caller!!! + ''' + def get_optic_temp(self, sysfs_sfp_i2c_client_eeprom_path, port_type): + + EEPROM_ADDR = 0x50 + DOM_ADDR = 0x51 + EEPROM_OFFSET = 0 + DOM_OFFSET = 256 + + SFP_DMT_ADDR = 92 + SFP_DMT_WIDTH = 1 + SFP_TEMP_DATA_ADDR = 96 + SFP_TEMP_DATA_WIDTH = 2 + + QSFP_TEMP_DATA_ADDR = 22 + QSFP_TEMP_DATA_WIDTH = 2 + temperature_raw = None + + + ''' Open file here ''' + try: + sysfsfile_eeprom = open(sysfs_sfp_i2c_client_eeprom_path, mode="rb", buffering=0) + except IOError: + print("Error: reading sysfs file %s" % sysfs_sfp_i2c_client_eeprom_path) + return 0 + + if port_type == 'QSFP': + + # QSFP only have internal calibration mode. + cal_type = 1 + # read temperature raw value + temperature_raw = self.read_eeprom_specific_bytes(sysfsfile_eeprom,(EEPROM_OFFSET+QSFP_TEMP_DATA_ADDR),QSFP_TEMP_DATA_WIDTH) + else: + # read calibration type at bit 5 + cal_type = self.read_eeprom_specific_bytes(sysfsfile_eeprom,EEPROM_OFFSET+SFP_DMT_ADDR,SFP_DMT_WIDTH) + if cal_type is None: + return 0 + else: + cal_type = (int(cal_type[0],16) >> 5 ) & 1 + # read temperature raw value + temperature_raw = self.read_eeprom_specific_bytes(sysfsfile_eeprom,(DOM_OFFSET+SFP_TEMP_DATA_ADDR),SFP_TEMP_DATA_WIDTH) + + try: + sysfsfile_eeprom.close() + except IOError: + print("Error: closing sysfs file %s" % file_path) + return 0 + + #calculate temperature + if temperature_raw is not None: + return self.calc_temperature(cal_type, temperature_raw, 0, 2) + else: + return 0 \ No newline at end of file diff --git a/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/psuutil.py b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/psuutil.py new file mode 100644 index 000000000000..55c3a41e1f68 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/psuutil.py @@ -0,0 +1,248 @@ +#!/usr/bin/env python + +__author__ = 'Wirut G.' +__license__ = "GPL" +__version__ = "0.1.4" +__status__ = "Development" + +import requests +import re + +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.fru_status_url = "http://240.1.1.1:8080/api/sys/fruid/status" + self.psu_info_url = "http://240.1.1.1:8080/api/sys/fruid/psu" + + self.fru_status_list = None + self.psu_info_list = None + + def request_data(self): + # Reqest data from BMC if not exist. + if self.fru_status_list is None or self.psu_info_list is None: + fru_status_req = requests.get(self.fru_status_url) + psu_info_req = requests.get(self.psu_info_url) + fru_status_json = fru_status_req.json() + psu_info_json = psu_info_req.json() + self.fru_status_list = fru_status_json.get('Information') + self.psu_info_list = psu_info_json.get('Information') + return self.fru_status_list, self.psu_info_list + + def airflow_selector(self, pn): + # Set airflow type + pn = pn.upper() + if "DPS-1100FB" in pn: + airflow = "FTOB" + elif "DPS-1100AB" in pn: + airflow = "BTOF" + elif "FSJ026-A20G" in pn: + airflow = "FTOB" + elif "FSJ038-A20G" in pn: + airflow = "BTOF" + else: + airflow = "Unknown" + return airflow + + 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 + """ + + num_psus = 4 + + return num_psus + + 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 + """ + + # init data + psu_key = "PSU" + str(index) + psu_status_key = "Power Status" + psu_power_status = False + + try: + # Request and validate sensor's information + self.fru_status_list, self.psu_info_list = self.request_data() + + # Get PSU power status. + for fru_status in self.fru_status_list: + is_psu = fru_status.get(psu_key) + psu_status = str(fru_status.get(psu_status_key)).strip() + + if is_psu is not None and psu_status == "OK": + psu_power_status = True + + except: + print("Error: Unable to access PSU power status") + return False + + return psu_power_status + + 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 + """ + + # Init data + psu_key = "PSU" + str(index) + psu_presence_key = "Present" + psu_presence_status = False + + try: + # Request and validate sensor's information. + self.fru_status_list, self.psu_info_list = self.request_data() + + # Get PSU present status. + for fru_status in self.fru_status_list: + is_psu = fru_status.get(psu_key) + psu_status = str(fru_status.get(psu_presence_key)).strip() + + if is_psu is not None and psu_status == "Present": + psu_presence_status = True + + except: + print("Error: Unable to access PSU presence status") + return False + + return psu_presence_status + + def get_psu_sn(self, index): + """ + Get the serial number of the psu, + + :param index: An integer, 1-based index of the PSU. + :return: Serial number + """ + serial_number = "N/A" + psu_key = "PSU" + str(index) + " FRU" + psu_sn_key = "Serial Number" + + try: + # Request and validate sensor's information. + self.fru_status_list, self.psu_info_list = self.request_data() + + # Get PSU fru info. + for psu_fru in self.psu_info_list: + psu_sn = str(psu_fru.get(psu_sn_key)).strip() + if psu_fru.get(psu_key) is not None: + serial_number = psu_sn if psu_sn.strip() != "" else "N/A" + break + + except: + return "N/A" + + return serial_number + + def get_psu_pn(self, index): + """ + Get the product name of the psu + + :param index: An integer, 1-based index of the PSU. + :return: Product name + """ + product_name = "N/A" + psu_key = "PSU" + str(index) + " FRU" + psu_pn_key = "Product Name" + + try: + # Request and validate sensor's information + self.fru_status_list, self.psu_info_list = self.request_data() + + # Get PSU fru info. + for psu_fru in self.psu_info_list: + psu_pn = str(psu_fru.get(psu_pn_key)).strip() + if psu_fru.get(psu_key) is not None: + product_name = psu_pn if psu_pn.strip() != "" else "N/A" + break + + except: + return "N/A" + + return product_name + + def get_all(self): + """ + Number: mandatory, max number of PSU, integer + PSU1, PSU2, ...: mandatory, PSU name, string + Present: mandatory for each PSU, present status, boolean, True for present, False for NOT present + PowerStatus: conditional, if PRESENT is True, power status of PSU,boolean, True for powered, False for NOT powered + PN, conditional, if PRESENT is True, PN of the PSU, string + SN, conditional, if PRESENT is True, SN of the PSU, string + """ + + # Init data + all_psu_dict = dict() + all_psu_dict["Number"] = self.get_num_psus() + psu_sn_key_1 = "Serial Number" + psu_sn_key_2 = "Product Serial" + psu_pn_key = "Product Name" + + # Request and validate sensor's information. + self.fru_status_list, self.psu_info_list = self.request_data() + + # Set PSU FRU data. + psu_info_dict = dict() + for psu_fru in self.psu_info_list: + psu_data = dict() + pn = psu_fru.get(psu_pn_key) + sn = psu_fru.get(psu_sn_key_1) or psu_fru.get(psu_sn_key_2) + psu_data["PN"] = "N/A" if not pn or str( + pn).strip() == "" else str(pn).strip() + psu_data["SN"] = "N/A" if not pn or str( + pn).strip() == "" else str(sn).strip() + + fru_check = [psu_fru[v] for v in psu_fru.keys() if 'FRU Info' in v] + non_fru_check = [v for v in psu_fru.keys() if 'PSU' in v] + + if len(non_fru_check) > 0: + psu_idx = int(re.findall('\d+', non_fru_check[0])[0]) + psu_info_dict[psu_idx] = psu_data + elif len(fru_check) > 0: + psu_idx = int(re.findall('\d+', fru_check[0])[0]) + psu_info_dict[psu_idx] = psu_data + + # Set PSU status. + for fru_status in self.fru_status_list: + psu_status_dict = dict() + find_psu = [v for v in fru_status.keys() if "PSU" in v] + if len(find_psu) > 0: + psu_idx = int(re.findall('\d+', find_psu[0])[0]) + psu_ps_status = True if str(fru_status.get( + "Present")).strip() == "Present" else False + psu_pw_status = True if str(fru_status.get( + "Power Status")).strip() == "OK" else False + psu_pw_type = str(fru_status.get( + "Power Type")).strip() + ac_status = True if str(fru_status.get( + "AC Status")).strip().upper() == "OK" else False + + psu_status_dict["Present"] = psu_ps_status + if psu_ps_status: + psu_status_dict["PowerStatus"] = psu_pw_status + psu_status_dict["PN"] = psu_info_dict[psu_idx]["PN"] + psu_status_dict["SN"] = psu_info_dict[psu_idx]["SN"] + psu_status_dict["InputType"] = psu_pw_type + psu_status_dict["InputStatus"] = True if psu_pw_status and psu_ps_status else False + psu_status_dict["OutputStatus"] = ac_status + psu_status_dict["AirFlow"] = self.airflow_selector( + psu_status_dict["PN"]) + all_psu_dict[find_psu[0]] = psu_status_dict + + return all_psu_dict diff --git a/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/sensorutil.py b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/sensorutil.py new file mode 100644 index 000000000000..29f56e8578e6 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/sensorutil.py @@ -0,0 +1,383 @@ +#!/usr/bin/env python + +__author__ = 'Wirut G.' +__license__ = "GPL" +__version__ = "0.2.0" +__status__ = "Development" + +import requests + + +class SensorUtil(): + """Platform-specific SensorUtil class""" + + def __init__(self): + self.sensor_url = "http://240.1.1.1:8080/api/sys/sensors" + self.sys_fruid_url = "http://240.1.1.1:8080/api/sys/fruid/sys" + self.sensor_info_list = None + + def request_data(self): + # Reqest data from BMC if not exist. + if self.sensor_info_list is None: + sensor_data_req = requests.get(self.sensor_url) + sensor_json = sensor_data_req.json() + self.sensor_info_list = sensor_json.get('Information') + sys_fruid_req = requests.get(self.sys_fruid_url) + sys_fruid_json = sys_fruid_req.json() + self.sys_fruid_list = sys_fruid_json.get('Information') + return self.sensor_info_list + + def input_type_selector(self, unit): + # Set input type. + return { + "C": "temperature", + "V": "voltage", + "RPM": "RPM", + "A": "amp", + "W": "power" + }.get(unit, unit) + + def input_name_selector(self, sensor_name, input_name): + + self.sensor_name = { + "syscpld-i2c-0-0d": "TEMPERATURE", + "dps1100-i2c-27-58": "PSU1", + "dps1100-i2c-26-58": "PSU2", + "dps1100-i2c-25-58": "PSU3", + "dps1100-i2c-24-58": "PSU4", + "fancpld-i2c-8-0d": "FAN", + "isl68137-i2c-17-60": "ISL68137" + }.get(sensor_name, sensor_name) + + if 'dps1100' in sensor_name: + input_name = { + "fan1": self.sensor_name + "_FAN", + "iin": self.sensor_name + "_CURR_I", + "iout1": self.sensor_name + "_CURR_O", + "pin": self.sensor_name + "_POWER_I", + "pout1": self.sensor_name + "_POWER_O", + "temp1": self.sensor_name + "_TEMP1", + "temp2": self.sensor_name + "_TEMP2", + "vin": self.sensor_name + "_VOL_I", + "vout1": self.sensor_name + "_VOL_O" + }.get(input_name, input_name) + + elif 'isl68137' in sensor_name: + input_name = { + "iin": self.sensor_name + "_CURR_I", + "iout2": self.sensor_name + "_CURR_O", + "pin": self.sensor_name + "_POWER_I", + "pout2": self.sensor_name + "_POWER_O", + "vin": self.sensor_name + "_VOL_I", + "vout2": self.sensor_name + "_VOL_O", + "temp1": self.sensor_name + "_TEMP1" + }.get(input_name, input_name) + + elif 'tmp75' in sensor_name or 'max31730' in sensor_name: + input_name = { + "tmp75-i2c-7-4f": "BASEBOARD_INLET_RIGHT", + "tmp75-i2c-7-4e": "BASEBOARD_INLET_CENTER", + "tmp75-i2c-7-4d": "SWITCH_OUTLET", + "tmp75-i2c-31-48": "PSU_INLET_LEFT", + "tmp75-i2c-31-49": "INLET_TEMP", + "tmp75-i2c-39-48": "FANBOARD_LEFT", + "tmp75-i2c-39-49": "FANBOARD_RIGHT", + "tmp75-i2c-42-48": "LINECARD_TOP_RIGHT", + "tmp75-i2c-42-49": "LINECARD_TOP_LEFT", + "tmp75-i2c-43-48": "LINECARD_BOTTOM_RIGHT", + "tmp75-i2c-43-49": "LINECARD_BOTTOM_LEFT", + "max31730-i2c-7-4c": "SWITCH_REMOTE_" + input_name + }.get(sensor_name, input_name) + self.sensor_name = "TEMPERATURE" + + elif 'fancpld' in sensor_name: + raw_fan_input = input_name.split() + input_name = raw_fan_input[0] + \ + raw_fan_input[1] + "_" + raw_fan_input[2] + + elif 'ir35' in sensor_name or 'ir38' in sensor_name: + sensor_name_raw = sensor_name.split("-") + sensor_name = sensor_name_raw[0] + self.sensor_name = sensor_name.upper() + + return input_name.replace(" ", "_").upper() + + def get_num_sensors(self): + """ + Get the number of sensors + :return: int num_sensors + """ + + num_sensors = 0 + try: + # Request and validate sensor's information + self.sensor_info_list = self.request_data() + + # Get number of sensors. + num_sensors = len(self.sensor_info_list) + except: + print "Error: Unable to access sensor information" + return 0 + + return num_sensors + + def get_sensor_input_num(self, index): + """ + Get the number of the input items of the specified sensor + :return: int input_num + """ + + input_num = 0 + try: + # Request and validate sensor's information. + self.sensor_info_list = self.request_data() + + # Get sensor's input number. + sensor_data = self.sensor_info_list[index-1] + input_num = len(sensor_data.keys())-2 + except: + print "Error: Unable to access sensor information" + return 0 + + return input_num + + def get_sensor_name(self, index): + """ + Get the device name of the specified sensor. + for example "coretemp-isa-0000" + :return: str sensor_name + """ + + sensor_name = "N/A" + try: + # Request and validate sensor's information. + self.sensor_info_list = self.request_data() + + # Get sensor's name. + sensor_data = self.sensor_info_list[index-1] + sensor_name = sensor_data.get('name') + + except: + return "N/A" + + return sensor_name + + def get_sensor_input_name(self, sensor_index, input_index): + """ + Get the input item name of the specified input item of the + specified sensor index, for example "Physical id 0" + :return: str sensor_input_name + """ + + sensor_input_name = "N/A" + try: + # Request and validate sensor's information. + self.sensor_info_list = self.request_data() + sensor_data = self.sensor_info_list[sensor_index-1].copy() + + # Remove none input key. + del sensor_data["name"] + del sensor_data["Adapter"] + + # Get sensor's input name. + sensor_data_key = sensor_data.keys() + sensor_input_name = sensor_data_key[input_index-1] + except: + return "N/A" + + return sensor_input_name + + def get_sensor_input_type(self, sensor_index, input_index): + """ + Get the item type of the specified input item of the specified sensor index, + The return value should among "valtage","temperature" + :return: str sensor_input_type + """ + + sensor_input_type = "N/A" + try: + # Request and validate sensor's information. + self.sensor_info_list = self.request_data() + sensor_data = self.sensor_info_list[sensor_index-1].copy() + + # Remove none input key. + del sensor_data["name"] + del sensor_data["Adapter"] + + # Get sensor's input type name. + sensor_data_key = sensor_data.keys() + sensor_input_raw = sensor_data.get(sensor_data_key[input_index-1]) + sensor_data_str = sensor_input_raw.split() + sensor_input_type = self.input_type_selector(sensor_data_str[1]) + except: + return "N/A" + + return sensor_input_type + + def get_sensor_input_value(self, sensor_index, input_index): + """ + Get the current value of the input item, the unit is "V" or "C" + :return: float sensor_input_value + """ + + sensor_input_value = 0 + try: + # Request and validate sensor's information. + self.sensor_info_list = self.request_data() + sensor_data = self.sensor_info_list[sensor_index-1].copy() + + # Remove none input key. + del sensor_data["name"] + del sensor_data["Adapter"] + + # Get sensor's input value. + sensor_data_key = sensor_data.keys() + sensor_input_raw = sensor_data.get(sensor_data_key[input_index-1]) + sensor_data_str = sensor_input_raw.split() + sensor_input_value = float( + sensor_data_str[0]) if sensor_data_str[0] != "N/A" else 0 + except: + print "Error: Unable to access sensor information" + return 0 + + return sensor_input_value + + def get_sensor_input_low_threshold(self, sensor_index, input_index): + """ + Get the low threshold of the value, + the status of this item is not ok if the current value 1: + sensor_input_low_threshold = l_thres * \ + 1000 if str(unit[0]).lower() == 'k' else l_thres + except: + print "Error: Unable to access sensor information" + return 0 + + return sensor_input_low_threshold + + def get_sensor_input_high_threshold(self, sensor_index, input_index): + """ + Get the high threshold of the value, + the status of this item is not ok if the current value > high_threshold + :return: float sensor_input_high_threshold + """ + + sensor_input_high_threshold = 0 + try: + # Request and validate sensor's information. + self.sensor_info_list = self.request_data() + sensor_data = self.sensor_info_list[sensor_index-1].copy() + + # Remove none input key. + del sensor_data["name"] + del sensor_data["Adapter"] + + # Get sensor's input high threshold. + sensor_data_key = sensor_data.keys() + sensor_input_raw = sensor_data.get(sensor_data_key[input_index-1]) + sensor_data_str = sensor_input_raw.split() + indices = [i for i, s in enumerate( + sensor_data_str) if 'max' in s or 'high' in s] + h_thres = float( + sensor_data_str[indices[0] + 2]) if len(indices) != 0 else 0 + unit = sensor_data_str[indices[0] + + 3] if len(indices) != 0 else None + if unit is not None and len(unit) > 1: + sensor_input_high_threshold = h_thres * \ + 1000 if str(unit[0]).lower() == 'k' else h_thres + + except: + print "Error: Unable to access sensor information" + return 0 + + return sensor_input_high_threshold + + def get_sys_airflow(self): + sys_air_flow = "Unknown" + sys_pn_data = [ + v.split(":") for v in self.sys_fruid_list if "Product Part Number" in v] + + if len(sys_pn_data) == 0: + return sys_air_flow + + sys_pn = sys_pn_data[0][1] + if "R1240-F0001" in sys_pn: + sys_air_flow = "FTOB" + elif"R1240-F0002" in sys_pn: + sys_air_flow = "BTOF" + + return sys_air_flow + + def get_all(self): + + all_sensor_dict = dict() + + # Request sensor's information. + self.sensor_info_list = self.request_data() + for sensor_data in self.sensor_info_list: + sensor_info = sensor_data.copy() + + # Remove none unuse key. + del sensor_info["name"] + del sensor_info["Adapter"] + + # Set sensor data. + sensor_dict = dict() + for k, v in sensor_info.items(): + sensor_i_dict = dict() + sensor_data_str = v.split() + indices_h = [i for i, s in enumerate( + sensor_data_str) if 'max' in s or 'high' in s] + indices_l = [i for i, s in enumerate( + sensor_data_str) if 'min' in s or 'low' in s] + h_thres = float( + sensor_data_str[indices_h[0] + 2]) if len(indices_h) != 0 else 0 + l_thres = float( + sensor_data_str[indices_l[0] + 2]) if len(indices_l) != 0 else 0 + thres_unit = sensor_data_str[-1] + + sensor_i_dict["Type"] = self.input_type_selector( + sensor_data_str[1]) + sensor_i_dict["Value"] = float( + sensor_data_str[0]) if sensor_data_str[0] != "N/A" else 0 + sensor_i_dict["HighThd"] = h_thres * \ + 1000 if str(thres_unit[0]).lower() == 'k' else h_thres + sensor_i_dict["LowThd"] = l_thres * \ + 1000 if str(thres_unit[0]).lower() == 'k' else l_thres + + k = self.input_name_selector(sensor_data.get('name'), k) + sensor_dict[k] = sensor_i_dict + + if all_sensor_dict.get(self.sensor_name) is None: + all_sensor_dict[self.sensor_name] = dict() + + all_sensor_dict[self.sensor_name].update(sensor_dict) + + sensor_dict = dict() + sensor_dict["Sys_AirFlow"] = self.get_sys_airflow() + all_sensor_dict["TEMPERATURE"].update(sensor_dict) + + return all_sensor_dict diff --git a/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/sfputil.py b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/sfputil.py new file mode 100755 index 000000000000..b721bbaee7e7 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/sfputil.py @@ -0,0 +1,247 @@ +#!/usr/bin/env python +# +# Platform-specific SFP transceiver interface for SONiC +# + +try: + import time + 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 + PORT_END = 128 + QSFP_PORT_START = 1 + QSFP_PORT_END = 128 + + EEPROM_OFFSET = 9 + PORT_INFO_PATH = '/sys/class/phalanx_fpga' + + _port_name = "" + _port_to_eeprom_mapping = {} + _port_to_i2cbus_mapping = {} + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(self.QSFP_PORT_START, self.QSFP_PORT_END + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + @property + def port_to_i2cbus_mapping(self): + return self._port_to_i2cbus_mapping + + def get_port_name(self, port_num): + if port_num in self.qsfp_ports: + self._port_name = "QSFP" + str(port_num - self.QSFP_PORT_START + 1) + else: + self._port_name = "SFP" + str(port_num) + return self._port_name + + def get_eeprom_dom_raw(self, port_num): + if port_num in self.qsfp_ports: + # QSFP DOM EEPROM is also at addr 0x50 and thus also stored in eeprom_ifraw + return None + else: + # Read dom eeprom at addr 0x51 + return self._read_eeprom_devid(port_num, self.DOM_EEPROM_ADDR, 256) + + def __init__(self): + # Override port_to_eeprom_mapping for class initialization + eeprom_path = '/sys/bus/i2c/devices/i2c-{0}/{0}-0050/eeprom' + + for x in range(self.PORT_START, self.PORT_END+1): + self.port_to_i2cbus_mapping[x] = (x + self.EEPROM_OFFSET) + self.port_to_eeprom_mapping[x] = eeprom_path.format( + x + self.EEPROM_OFFSET) + SfpUtilBase.__init__(self) + + def _do_write_file(self, file_handle, offset, value): + file_handle.seek(offset) + file_handle.write(hex(value)) + file_handle.close() + + def get_presence(self, port_num): + + # Check for invalid port_num + if port_num not in range(self.port_start, self.port_end + 1): + return False + + # Get path for access port presence status + port_name = self.get_port_name(port_num) + sysfs_filename = "qsfp_modprs" if port_num in self.qsfp_ports else "sfp_modabs" + reg_path = "/".join([self.PORT_INFO_PATH, port_name, sysfs_filename]) + + # Read status + try: + reg_file = open(reg_path) + content = reg_file.readline().rstrip() + reg_value = int(content) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + # Module present is active low + if reg_value == 0: + return True + + return False + + def get_low_power_mode(self, port_num): + return NotImplementedError + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid QSFP port_num + if port_num not in self.qsfp_ports: + return False + + try: + port_name = self.get_port_name(port_num) + reg_file = open( + "/".join([self.PORT_INFO_PATH, port_name, "qsfp_lpmode"]), "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = hex(lpmode) + + reg_file.seek(0) + reg_file.write(content) + reg_file.close() + + return True + + def reset(self, port_num): + # Check for invalid QSFP port_num + if port_num not in self.qsfp_ports: + return False + + try: + port_name = self.get_port_name(port_num) + reg_file = open( + "/".join([self.PORT_INFO_PATH, port_name, "qsfp_reset"]), "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + # Convert our register value back to a hex string and write back + reg_file.seek(0) + reg_file.write(hex(0)) + reg_file.close() + + # Sleep 1 second to allow it to settle + time.sleep(1) + + # Flip the bit back high and write back to the register to take port out of reset + try: + reg_file = open( + "/".join([self.PORT_INFO_PATH, port_name, "qsfp_reset"]), "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_file.seek(0) + reg_file.write(hex(1)) + reg_file.close() + + return True + + def get_transceiver_change_event(self, timeout=0): + """ + TBD + """ + return NotImplementedError + + def tx_disable(self, port_num, disable): + """ + @param port_num index of physical port + @param disable, True -- disable port tx signal + False -- enable port tx signal + @return True when operation success, False on failure. + """ + TX_DISABLE_BYTE_OFFSET = 86 + if port_num not in range(self.port_start, self.port_end + 1) or type(disable) != bool: + return False + + # QSFP, set eeprom to disable tx + if port_num in self.qsfp_ports: + presence = self.get_presence(port_num) + if not presence: + return True + + disable = b'\x0f' if disable else b'\x00' + # open eeprom + try: + with open(self.port_to_eeprom_mapping[port_num], mode="wb", buffering=0) as sysfsfile: + sysfsfile.seek(TX_DISABLE_BYTE_OFFSET) + sysfsfile.write(bytearray(disable)) + except IOError: + return False + except: + return False + + # SFP, set tx_disable pin + else: + try: + disable = hex(1) if disable else hex(0) + port_name = self.get_port_name(port_num) + reg_file = open( + "/".join([self.PORT_INFO_PATH, port_name, "sfp_txdisable"]), "w") + reg_file.write(disable) + reg_file.close() + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + return True + + def reset_all(self): + result = True + port_sysfs_path = [] + for port in range(self.port_start, self.port_end+1): + if port not in self.qsfp_ports: + continue + + presence = self.get_presence(port) + if not presence: + continue + + try: + port_name = self.get_port_name(port) + sysfs_path = "/".join([self.PORT_INFO_PATH, + port_name, "qsfp_reset"]) + print(sysfs_path) + reg_file = open(sysfs_path, "w") + port_sysfs_path.append(sysfs_path) + except IOError as e: + result = False + continue + + self._do_write_file(reg_file, 0, 0) + + time.sleep(1) + + for sysfs_path in port_sysfs_path: + try: + reg_file = open(sysfs_path, "w") + except IOError as e: + result = False + continue + + self._do_write_file(reg_file, 0, 1) + + return result diff --git a/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/th3-as23-128h.config.bcm b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/th3-as23-128h.config.bcm new file mode 100644 index 000000000000..354e0f2fad00 --- /dev/null +++ b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/th3-as23-128h.config.bcm @@ -0,0 +1,631 @@ +pbmp_xport_xe.0=0x0ffff0ffff0ffff0ffff0ffff0ffff0ffff1fffe +ccm_dma_enable=0 +ccmdma_intr_enable=0 +ctr_evict_enable=0 +mem_cache_enable=0 +parity_correction=0 +parity_enable=0 +phy_enable=0 +phy_null=1 +pll_bypass=1 +port_fec=3 +serdes_tx_taps_ce=pam4:0:140:0:0:0:0 + +init_all_modules=0 +mdio_output_delay=64 + +#BC1 +portmap_5=9:100:2 +portmap_6=11:100:2 +portmap_7=13:100:2 +portmap_8=15:100:2 + +dport_map_port_5=1 +dport_map_port_6=2 +dport_map_port_7=4 +dport_map_port_8=3 + +#BC9 +portmap_44=73:100:2 +portmap_45=75:100:2 +portmap_46=77:100:2 +portmap_47=79:100:2 + +dport_map_port_44=8 +dport_map_port_45=7 +dport_map_port_46=5 +dport_map_port_47=6 + +#BC0 +portmap_1=1:100:2 +portmap_2=3:100:2 +portmap_3=5:100:2 +portmap_4=7:100:2 + +dport_map_port_1=9 +dport_map_port_2=10 +dport_map_port_3=12 +dport_map_port_4=11 + +#BC8 +portmap_40=65:100:2 +portmap_41=67:100:2 +portmap_42=69:100:2 +portmap_43=71:100:2 + +dport_map_port_40=16 +dport_map_port_41=15 +dport_map_port_42=13 +dport_map_port_43=14 + +#BC5 +portmap_24=41:100:2 +portmap_25=43:100:2 +portmap_26=45:100:2 +portmap_27=47:100:2 + +dport_map_port_24=17 +dport_map_port_25=18 +dport_map_port_26=20 +dport_map_port_27=19 + +#BC13 +portmap_64=105:100:2 +portmap_65=107:100:2 +portmap_66=109:100:2 +portmap_67=111:100:2 + +dport_map_port_64=24 +dport_map_port_65=23 +dport_map_port_66=21 +dport_map_port_67=22 + +#BC4 +portmap_20=33:100:2 +portmap_21=35:100:2 +portmap_22=37:100:2 +portmap_23=39:100:2 + +dport_map_port_20=25 +dport_map_port_21=26 +dport_map_port_22=28 +dport_map_port_23=27 + +#BC12 +portmap_60=97:100:2 +portmap_61=99:100:2 +portmap_62=101:100:2 +portmap_63=103:100:2 + +dport_map_port_60=32 +dport_map_port_61=31 +dport_map_port_62=29 +dport_map_port_63=30 + +#BC17 +portmap_84=137:100:2 +portmap_85=139:100:2 +portmap_86=141:100:2 +portmap_87=143:100:2 + +dport_map_port_84=33 +dport_map_port_85=34 +dport_map_port_86=36 +dport_map_port_87=35 + +#BC25 +portmap_124=201:100:2 +portmap_125=203:100:2 +portmap_126=205:100:2 +portmap_127=207:100:2 + +dport_map_port_124=40 +dport_map_port_125=39 +dport_map_port_126=37 +dport_map_port_127=38 + +#BC16 +portmap_80=129:100:2 +portmap_81=131:100:2 +portmap_82=133:100:2 +portmap_83=135:100:2 + +dport_map_port_80=41 +dport_map_port_81=42 +dport_map_port_82=44 +dport_map_port_83=43 + +#BC24 +portmap_120=193:100:2 +portmap_121=195:100:2 +portmap_122=197:100:2 +portmap_123=199:100:2 + +dport_map_port_120=48 +dport_map_port_121=47 +dport_map_port_122=45 +dport_map_port_123=46 + +#BC21 +portmap_104=169:100:2 +portmap_105=171:100:2 +portmap_106=173:100:2 +portmap_107=175:100:2 + +dport_map_port_104=49 +dport_map_port_105=50 +dport_map_port_106=52 +dport_map_port_107=51 + +#BC29 +portmap_144=233:100:2 +portmap_145=235:100:2 +portmap_146=237:100:2 +portmap_147=239:100:2 + +dport_map_port_144=56 +dport_map_port_145=55 +dport_map_port_146=53 +dport_map_port_147=54 + +#BC20 +portmap_100=161:100:2 +portmap_101=163:100:2 +portmap_102=165:100:2 +portmap_103=167:100:2 + +dport_map_port_100=57 +dport_map_port_101=58 +dport_map_port_102=60 +dport_map_port_103=59 + +#BC28 +portmap_140=225:100:2 +portmap_141=227:100:2 +portmap_142=229:100:2 +portmap_143=231:100:2 + +dport_map_port_140=64 +dport_map_port_141=63 +dport_map_port_142=61 +dport_map_port_143=62 + +#BC3 +portmap_13=25:100:2 +portmap_14=27:100:2 +portmap_15=29:100:2 +portmap_16=31:100:2 + +dport_map_port_13=65 +dport_map_port_14=66 +dport_map_port_15=68 +dport_map_port_16=67 + +#BC11 +portmap_52=89:100:2 +portmap_53=91:100:2 +portmap_54=93:100:2 +portmap_55=95:100:2 + +dport_map_port_52=72 +dport_map_port_53=71 +dport_map_port_54=69 +dport_map_port_55=70 + +#BC2 +portmap_9=17:100:2 +portmap_10=19:100:2 +portmap_11=21:100:2 +portmap_12=23:100:2 + +dport_map_port_9=73 +dport_map_port_10=74 +dport_map_port_11=76 +dport_map_port_12=75 + +#BC10 +portmap_48=81:100:2 +portmap_49=83:100:2 +portmap_50=85:100:2 +portmap_51=87:100:2 + +dport_map_port_48=80 +dport_map_port_49=79 +dport_map_port_50=77 +dport_map_port_51=78 + +#BC7 +portmap_32=57:100:2 +portmap_33=59:100:2 +portmap_34=61:100:2 +portmap_35=63:100:2 + +dport_map_port_32=81 +dport_map_port_33=82 +dport_map_port_34=84 +dport_map_port_35=83 + +#BC15 +portmap_72=121:100:2 +portmap_73=123:100:2 +portmap_74=125:100:2 +portmap_75=127:100:2 + +dport_map_port_72=88 +dport_map_port_73=87 +dport_map_port_74=85 +dport_map_port_75=86 + +#BC6 +portmap_28=49:100:2 +portmap_29=51:100:2 +portmap_30=53:100:2 +portmap_31=55:100:2 + +dport_map_port_28=89 +dport_map_port_29=90 +dport_map_port_30=92 +dport_map_port_31=91 + +#BC14 +portmap_68=113:100:2 +portmap_69=115:100:2 +portmap_70=117:100:2 +portmap_71=119:100:2 + +dport_map_port_68=96 +dport_map_port_69=95 +dport_map_port_70=93 +dport_map_port_71=94 + +#BC19 +portmap_92=153:100:2 +portmap_93=155:100:2 +portmap_94=157:100:2 +portmap_95=159:100:2 + +dport_map_port_92=97 +dport_map_port_93=98 +dport_map_port_94=100 +dport_map_port_95=99 + +#BC27 +portmap_132=217:100:2 +portmap_133=219:100:2 +portmap_134=221:100:2 +portmap_135=223:100:2 + +dport_map_port_132=104 +dport_map_port_133=103 +dport_map_port_134=101 +dport_map_port_135=102 + +#BC18 +portmap_88=145:100:2 +portmap_89=147:100:2 +portmap_90=149:100:2 +portmap_91=151:100:2 + +dport_map_port_88=105 +dport_map_port_89=106 +dport_map_port_90=108 +dport_map_port_91=107 + +#BC26 +portmap_128=209:100:2 +portmap_129=211:100:2 +portmap_130=213:100:2 +portmap_131=215:100:2 + +dport_map_port_128=112 +dport_map_port_129=111 +dport_map_port_130=109 +dport_map_port_131=110 + +#BC23 +portmap_112=185:100:2 +portmap_113=187:100:2 +portmap_114=189:100:2 +portmap_115=191:100:2 + +dport_map_port_112=113 +dport_map_port_113=114 +dport_map_port_114=116 +dport_map_port_115=115 + +#BC31 +portmap_152=249:100:2 +portmap_153=251:100:2 +portmap_154=253:100:2 +portmap_155=255:100:2 + +dport_map_port_152=120 +dport_map_port_153=119 +dport_map_port_154=117 +dport_map_port_155=118 + +#BC22 +portmap_108=177:100:2 +portmap_109=179:100:2 +portmap_110=181:100:2 +portmap_111=183:100:2 + +dport_map_port_108=121 +dport_map_port_109=122 +dport_map_port_110=124 +dport_map_port_111=123 + +#BC30 +portmap_148=241:100:2 +portmap_149=243:100:2 +portmap_150=245:100:2 +portmap_151=247:100:2 + +dport_map_port_148=128 +dport_map_port_149=127 +dport_map_port_150=125 +dport_map_port_151=126 + +#BC1 +phy_chain_rx_lane_map_physical{9.0}=0x13026475 +phy_chain_tx_lane_map_physical{9.0}=0x21340756 + +#BC9 +phy_chain_rx_lane_map_physical{73.0}=0x47560213 +phy_chain_tx_lane_map_physical{73.0}=0x76540132 + +#BC0 +phy_chain_rx_lane_map_physical{1.0}=0x20314657 +phy_chain_tx_lane_map_physical{1.0}=0x32014567 + +#BC8 +phy_chain_rx_lane_map_physical{65.0}=0x13025647 +phy_chain_tx_lane_map_physical{65.0}=0x13204675 + +#BC5 +phy_chain_rx_lane_map_physical{41.0}=0x31207564 +phy_chain_tx_lane_map_physical{41.0}=0x23104567 + +#BC13 +phy_chain_rx_lane_map_physical{105.0}=0x63725140 +phy_chain_tx_lane_map_physical{105.0}=0x76541032 + +#BC4 +phy_chain_rx_lane_map_physical{33.0}=0x76452031 +phy_chain_tx_lane_map_physical{33.0}=0x67450123 + +#BC12 +phy_chain_rx_lane_map_physical{97.0}=0x31206574 +phy_chain_tx_lane_map_physical{97.0}=0x31025467 + +#BC17 +phy_chain_rx_lane_map_physical{137.0}=0x13025746 +phy_chain_tx_lane_map_physical{137.0}=0x23410576 + +#BC25 +phy_chain_rx_lane_map_physical{201.0}=0x47560213 +phy_chain_tx_lane_map_physical{201.0}=0x67450231 + +#BC16 +phy_chain_rx_lane_map_physical{129.0}=0x30214657 +phy_chain_tx_lane_map_physical{129.0}=0x13427065 + +#BC24 +phy_chain_rx_lane_map_physical{193.0}=0x13025647 +phy_chain_tx_lane_map_physical{193.0}=0x23104675 + +#BC21 +phy_chain_rx_lane_map_physical{169.0}=0x31206574 +phy_chain_tx_lane_map_physical{169.0}=0x13205476 + +#BC29 +phy_chain_rx_lane_map_physical{233.0}=0x65741302 +phy_chain_tx_lane_map_physical{233.0}=0x57610423 + +#BC20 +phy_chain_rx_lane_map_physical{161.0}=0x74652031 +phy_chain_tx_lane_map_physical{161.0}=0x57640132 + +#BC28 +phy_chain_rx_lane_map_physical{225.0}=0x16072435 +phy_chain_tx_lane_map_physical{225.0}=0x43127065 + +#BC3 laneswap +phy_chain_rx_lane_map_physical{25.0}=0x36271504 +phy_chain_tx_lane_map_physical{25.0}=0x13204576 + +#BC11 +phy_chain_rx_lane_map_physical{89.0}=0x47560213 +phy_chain_tx_lane_map_physical{89.0}=0x76540132 + +#BC2 +phy_chain_rx_lane_map_physical{17.0}=0x43507162 +phy_chain_tx_lane_map_physical{17.0}=0x46570123 + +#BC10 +phy_chain_rx_lane_map_physical{81.0}=0x13025647 +phy_chain_tx_lane_map_physical{81.0}=0x13204675 + +#BC7 +phy_chain_rx_lane_map_physical{57.0}=0x31207564 +phy_chain_tx_lane_map_physical{57.0}=0x23406175 + +#BC15 +phy_chain_rx_lane_map_physical{121.0}=0x13026475 +phy_chain_tx_lane_map_physical{121.0}=0x23507614 + +#BC6 +phy_chain_rx_lane_map_physical{49.0}=0x65742031 +phy_chain_tx_lane_map_physical{49.0}=0x57640231 + +#BC14 +phy_chain_rx_lane_map_physical{113.0}=0x02136574 +phy_chain_tx_lane_map_physical{113.0}=0x12436075 + +#BC19 +phy_chain_rx_lane_map_physical{153.0}=0x40516273 +phy_chain_tx_lane_map_physical{153.0}=0x32045671 + +#BC27 +phy_chain_rx_lane_map_physical{217.0}=0x64570213 +phy_chain_tx_lane_map_physical{217.0}=0x67054123 + +#BC18 +phy_chain_rx_lane_map_physical{145.0}=0x46570213 +phy_chain_tx_lane_map_physical{145.0}=0x57063421 + +#BC26 +phy_chain_rx_lane_map_physical{209.0}=0x13025647 +phy_chain_tx_lane_map_physical{209.0}=0x23104675 + +#BC23 +phy_chain_rx_lane_map_physical{185.0}=0x31207564 +phy_chain_tx_lane_map_physical{185.0}=0x13245076 + +#BC31 +phy_chain_rx_lane_map_physical{249.0}=0x02137564 +phy_chain_tx_lane_map_physical{249.0}=0x32106457 + +#BC22 +phy_chain_rx_lane_map_physical{177.0}=0x64752031 +phy_chain_tx_lane_map_physical{177.0}=0x57640132 + +#BC30 +phy_chain_rx_lane_map_physical{241.0}=0x31204657 +phy_chain_tx_lane_map_physical{241.0}=0x32016457 + +#BC1 +serdes_core_rx_polarity_flip_physical{9}=0x33 +serdes_core_tx_polarity_flip_physical{9}=0x71 + +#BC9 +serdes_core_rx_polarity_flip_physical{73}=0x93 +serdes_core_tx_polarity_flip_physical{73}=0xa9 + +#BC0 +serdes_core_rx_polarity_flip_physical{1}=0xc3 +serdes_core_tx_polarity_flip_physical{1}=0xdf + +#BC8 +serdes_core_rx_polarity_flip_physical{65}=0x39 +serdes_core_tx_polarity_flip_physical{65}=0xbe + +#BC5 +serdes_core_rx_polarity_flip_physical{41}=0x3c +serdes_core_tx_polarity_flip_physical{41}=0x6a + +#BC13 +serdes_core_rx_polarity_flip_physical{105}=0xc6 +serdes_core_tx_polarity_flip_physical{105}=0xaf + +#BC4 +serdes_core_rx_polarity_flip_physical{33}=0x63 +serdes_core_tx_polarity_flip_physical{33}=0x1c + +#BC12 +serdes_core_rx_polarity_flip_physical{97}=0x36 +serdes_core_tx_polarity_flip_physical{97}=0x7f + +#BC17 +serdes_core_rx_polarity_flip_physical{137}=0x3c +serdes_core_tx_polarity_flip_physical{137}=0x71 + +#BC25 +serdes_core_rx_polarity_flip_physical{201}=0x93 +serdes_core_tx_polarity_flip_physical{201}=0x5c + +#BC16 +serdes_core_rx_polarity_flip_physical{129}=0x63 +serdes_core_tx_polarity_flip_physical{129}=0x6f + +#BC24 +serdes_core_rx_polarity_flip_physical{193}=0x39 +serdes_core_tx_polarity_flip_physical{193}=0x1e + +#BC21 +serdes_core_rx_polarity_flip_physical{169}=0x32 +serdes_core_tx_polarity_flip_physical{169}=0xc5 + +#BC29 +serdes_core_rx_polarity_flip_physical{233}=0x9c +serdes_core_tx_polarity_flip_physical{233}=0xca + +#BC20 +serdes_core_rx_polarity_flip_physical{161}=0x63 +serdes_core_tx_polarity_flip_physical{161}=0x87 + +#BC28 +serdes_core_rx_polarity_flip_physical{225}=0x21 +serdes_core_tx_polarity_flip_physical{225}=0xca + +#Polarity BC3 +serdes_core_rx_polarity_flip_physical{25}=0x89 +serdes_core_tx_polarity_flip_physical{25}=0xcb + +#BC11 +serdes_core_rx_polarity_flip_physical{89}=0x93 +serdes_core_tx_polarity_flip_physical{89}=0xb9 + +#BC2 +serdes_core_rx_polarity_flip_physical{17}=0xc2 +serdes_core_tx_polarity_flip_physical{17}=0x8a +#BC10 +serdes_core_rx_polarity_flip_physical{81}=0x39 +serdes_core_tx_polarity_flip_physical{81}=0xbe + +#BC7 +serdes_core_rx_polarity_flip_physical{57}=0x3c +serdes_core_tx_polarity_flip_physical{57}=0x6c + +#BC15 +serdes_core_rx_polarity_flip_physical{121}=0x33 +serdes_core_tx_polarity_flip_physical{121}=0x47 + +#BC6 +serdes_core_rx_polarity_flip_physical{49}=0x93 +serdes_core_tx_polarity_flip_physical{49}=0x82 + +#BC14 +serdes_core_rx_polarity_flip_physical{113}=0x86 +serdes_core_tx_polarity_flip_physical{113}=0x08 + +#BC19 +serdes_core_rx_polarity_flip_physical{153}=0x66 +serdes_core_tx_polarity_flip_physical{153}=0xc6 + +#BC27 +serdes_core_rx_polarity_flip_physical{217}=0xc3 +serdes_core_tx_polarity_flip_physical{217}=0x52 + +#BC18 +serdes_core_rx_polarity_flip_physical{145}=0xc3 +serdes_core_tx_polarity_flip_physical{145}=0xef + +#BC26 +serdes_core_rx_polarity_flip_physical{209}=0x39 +serdes_core_tx_polarity_flip_physical{209}=0x3e + +#BC23 +serdes_core_rx_polarity_flip_physical{185}=0x3c +serdes_core_tx_polarity_flip_physical{185}=0xd5 + +#BC31 +serdes_core_rx_polarity_flip_physical{249}=0xcc +serdes_core_tx_polarity_flip_physical{249}=0xac + +#BC22 +serdes_core_rx_polarity_flip_physical{177}=0xc3 +serdes_core_tx_polarity_flip_physical{177}=0x83 + +#BC30 +serdes_core_rx_polarity_flip_physical{241}=0x33 +serdes_core_tx_polarity_flip_physical{241}=0x2d + +core_clock_frequency=1325 +dpr_clock_frequency=1000 +device_clock_frequency=1325 +port_flex_enable=1 + +#firmware load method, use fast load +load_firmware=0x2 + diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..38e34eb571e8 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers_defaults_t0.j2 @@ -0,0 +1,45 @@ +{%- 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": "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_qx32/Arista-7050-QX32/buffers_defaults_t1.j2 b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers_defaults_t1.j2 index 40d32ef316da..38e34eb571e8 100644 --- a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers_defaults_t1.j2 +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers_defaults_t1.j2 @@ -20,7 +20,7 @@ "mode": "static" }, "egress_lossy_pool": { - "size": "7582515", + "size": "7326924", "type": "egress", "mode": "dynamic" } diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/pg_profile_lookup.ini b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/pg_profile_lookup.ini index 135a598465ba..0588079e6840 100644 --- a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/pg_profile_lookup.ini +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/pg_profile_lookup.ini @@ -1,11 +1,11 @@ # PG lossless profiles. # speed cable size xon xoff threshold xon_offset - 40000 5m 41808 18432 40560 -3 2496 - 50000 5m 41808 18432 40560 -3 2496 - 100000 5m 41808 18432 40560 -3 2496 - 40000 40m 51376 18432 50128 -3 2496 - 50000 40m 51376 18432 50128 -3 2496 - 100000 40m 51376 18432 50128 -3 2496 - 40000 300m 51376 18432 50128 -3 2496 - 50000 300m 51376 18432 50128 -3 2496 - 100000 300m 51376 18432 50128 -3 2496 + 40000 5m 56368 18432 55120 -3 2496 + 50000 5m 56368 18432 55120 -3 2496 + 100000 5m 56368 18432 55120 -3 2496 + 40000 40m 56368 18432 55120 -3 2496 + 50000 40m 56368 18432 55120 -3 2496 + 100000 40m 56368 18432 55120 -3 2496 + 40000 300m 56368 18432 55120 -3 2496 + 50000 300m 56368 18432 55120 -3 2496 + 100000 300m 56368 18432 55120 -3 2496 diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..38e34eb571e8 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers_defaults_t0.j2 @@ -0,0 +1,45 @@ +{%- 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": "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-7050-QX-32S/buffers_defaults_t1.j2 b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers_defaults_t1.j2 index 40d32ef316da..38e34eb571e8 100644 --- a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers_defaults_t1.j2 +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers_defaults_t1.j2 @@ -20,7 +20,7 @@ "mode": "static" }, "egress_lossy_pool": { - "size": "7582515", + "size": "7326924", "type": "egress", "mode": "dynamic" } diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/pg_profile_lookup.ini b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/pg_profile_lookup.ini index 135a598465ba..0588079e6840 100644 --- a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/pg_profile_lookup.ini +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/pg_profile_lookup.ini @@ -1,11 +1,11 @@ # PG lossless profiles. # speed cable size xon xoff threshold xon_offset - 40000 5m 41808 18432 40560 -3 2496 - 50000 5m 41808 18432 40560 -3 2496 - 100000 5m 41808 18432 40560 -3 2496 - 40000 40m 51376 18432 50128 -3 2496 - 50000 40m 51376 18432 50128 -3 2496 - 100000 40m 51376 18432 50128 -3 2496 - 40000 300m 51376 18432 50128 -3 2496 - 50000 300m 51376 18432 50128 -3 2496 - 100000 300m 51376 18432 50128 -3 2496 + 40000 5m 56368 18432 55120 -3 2496 + 50000 5m 56368 18432 55120 -3 2496 + 100000 5m 56368 18432 55120 -3 2496 + 40000 40m 56368 18432 55120 -3 2496 + 50000 40m 56368 18432 55120 -3 2496 + 100000 40m 56368 18432 55120 -3 2496 + 40000 300m 56368 18432 55120 -3 2496 + 50000 300m 56368 18432 55120 -3 2496 + 100000 300m 56368 18432 55120 -3 2496 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers_defaults_t0.j2 index 3e39d411e8bf..cb74cb75281b 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers_defaults_t0.j2 +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers_defaults_t0.j2 @@ -11,13 +11,13 @@ {%- macro generate_buffer_pool_and_profiles() %} "BUFFER_POOL": { "ingress_lossless_pool": { - "size": "11213696", + "size": "10875072", "type": "ingress", "mode": "dynamic", - "xoff": "3855488" + "xoff": "4194112" }, "egress_lossy_pool": { - "size": "9532224", + "size": "9243812", "type": "egress", "mode": "dynamic" }, diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers_defaults_t1.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers_defaults_t1.j2 index d9f562f95624..0699433bffb4 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers_defaults_t1.j2 +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers_defaults_t1.j2 @@ -11,13 +11,13 @@ {%- macro generate_buffer_pool_and_profiles() %} "BUFFER_POOL": { "ingress_lossless_pool": { - "size": "10443264", + "size": "10875072", "type": "ingress", "mode": "dynamic", - "xoff": "4625920" + "xoff": "4194112" }, "egress_lossy_pool": { - "size": "8877440", + "size": "9243812", "type": "egress", "mode": "dynamic" }, diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/buffers_defaults_t0.j2 index 7463e20afabe..5d6e0cd61a7e 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/buffers_defaults_t0.j2 +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/buffers_defaults_t0.j2 @@ -25,13 +25,13 @@ {%- macro generate_buffer_pool_and_profiles() %} "BUFFER_POOL": { "ingress_lossless_pool": { - "size": "11213696", + "size": "10875072", "type": "ingress", "mode": "dynamic", - "xoff": "3855488" + "xoff": "4194112" }, "egress_lossy_pool": { - "size": "9532224", + "size": "9243812", "type": "egress", "mode": "dynamic" }, diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/pg_profile_lookup.ini b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/pg_profile_lookup.ini index 570454c8d5b2..dc05d0a100a3 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/pg_profile_lookup.ini +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/pg_profile_lookup.ini @@ -13,5 +13,5 @@ 10000 300m 1248 2288 46176 -3 2288 25000 300m 1248 2288 79040 -3 2288 40000 300m 1248 2288 108160 -3 2288 - 50000 300m 1248 2288 131456 -3 2288 + 50000 300m 1248 2288 141856 -3 2288 100000 300m 1248 2288 268736 -3 2288 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers_defaults_t0.j2 index 3e39d411e8bf..cb74cb75281b 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers_defaults_t0.j2 +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers_defaults_t0.j2 @@ -11,13 +11,13 @@ {%- macro generate_buffer_pool_and_profiles() %} "BUFFER_POOL": { "ingress_lossless_pool": { - "size": "11213696", + "size": "10875072", "type": "ingress", "mode": "dynamic", - "xoff": "3855488" + "xoff": "4194112" }, "egress_lossy_pool": { - "size": "9532224", + "size": "9243812", "type": "egress", "mode": "dynamic" }, diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers_defaults_t1.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers_defaults_t1.j2 index d9f562f95624..0699433bffb4 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers_defaults_t1.j2 +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers_defaults_t1.j2 @@ -11,13 +11,13 @@ {%- macro generate_buffer_pool_and_profiles() %} "BUFFER_POOL": { "ingress_lossless_pool": { - "size": "10443264", + "size": "10875072", "type": "ingress", "mode": "dynamic", - "xoff": "4625920" + "xoff": "4194112" }, "egress_lossy_pool": { - "size": "8877440", + "size": "9243812", "type": "egress", "mode": "dynamic" }, diff --git a/device/arista/x86_64-arista_7170_64c/Arista-7170-Q59S20/board_lane_map.json b/device/arista/x86_64-arista_7170_64c/Arista-7170-Q59S20/board_lane_map.json new file mode 100644 index 000000000000..dc81608655b7 --- /dev/null +++ b/device/arista/x86_64-arista_7170_64c/Arista-7170-Q59S20/board_lane_map.json @@ -0,0 +1,3534 @@ +{ + "board_name": "7170-64C", + "enable_debug_log": 0, + "board_lane_map_entry": [ + { + "connector": 1, + "device_id": 0, + "mac_block": 63, + "media_type": "optic", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 2, + "device_id": 0, + "mac_block": 2, + "media_type": "optic", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 3, + "device_id": 0, + "mac_block": 61, + "media_type": "optic", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 4, + "device_id": 0, + "mac_block": 60, + "media_type": "optic", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 5, + "device_id": 0, + "mac_block": 55, + "media_type": "optic", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 6, + "device_id": 0, + "mac_block": 58, + "media_type": "optic", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 7, + "device_id": 0, + "mac_block": 53, + "media_type": "optic", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 8, + "device_id": 0, + "mac_block": 15, + "media_type": "optic", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 9, + "device_id": 0, + "mac_block": 12, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 10, + "device_id": 0, + "mac_block": 13, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 11, + "device_id": 0, + "mac_block": 9, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 12, + "device_id": 0, + "mac_block": 7, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 13, + "device_id": 0, + "mac_block": 4, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 14, + "device_id": 0, + "mac_block": 5, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 15, + "device_id": 0, + "mac_block": 51, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 16, + "device_id": 0, + "mac_block": 50, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 17, + "device_id": 0, + "mac_block": 46, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 18, + "device_id": 0, + "mac_block": 48, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 19, + "device_id": 0, + "mac_block": 29, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 20, + "device_id": 0, + "mac_block": 27, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 21, + "device_id": 0, + "mac_block": 24, + "media_type": "optic", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 22, + "device_id": 0, + "mac_block": 25, + "media_type": "optic", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 23, + "device_id": 0, + "mac_block": 21, + "media_type": "optic", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 24, + "device_id": 0, + "mac_block": 19, + "media_type": "optic", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 25, + "device_id": 0, + "mac_block": 43, + "media_type": "optic", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 26, + "device_id": 0, + "mac_block": 17, + "media_type": "optic", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 27, + "device_id": 0, + "mac_block": 41, + "media_type": "optic", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 28, + "device_id": 0, + "mac_block": 40, + "media_type": "optic", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 29, + "device_id": 0, + "mac_block": 35, + "media_type": "optic", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 30, + "device_id": 0, + "mac_block": 38, + "media_type": "optic", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 31, + "device_id": 0, + "mac_block": 33, + "media_type": "optic", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 32, + "device_id": 0, + "mac_block": 32, + "media_type": "optic", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 33, + "device_id": 0, + "mac_block": 1, + "media_type": "optic", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 34, + "device_id": 0, + "mac_block": 0, + "media_type": "optic", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 35, + "device_id": 0, + "mac_block": 59, + "media_type": "optic", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 36, + "device_id": 0, + "mac_block": 62, + "media_type": "optic", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 37, + "device_id": 0, + "mac_block": 57, + "media_type": "optic", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 38, + "device_id": 0, + "mac_block": 56, + "media_type": "optic", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 39, + "device_id": 0, + "mac_block": 16, + "media_type": "optic", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 40, + "device_id": 0, + "mac_block": 54, + "media_type": "optic", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 41, + "device_id": 0, + "mac_block": 14, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 42, + "device_id": 0, + "mac_block": 11, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 43, + "device_id": 0, + "mac_block": 8, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 44, + "device_id": 0, + "mac_block": 10, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 45, + "device_id": 0, + "mac_block": 6, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 46, + "device_id": 0, + "mac_block": 3, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 47, + "device_id": 0, + "mac_block": 49, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 48, + "device_id": 0, + "mac_block": 52, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 49, + "device_id": 0, + "mac_block": 47, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 50, + "device_id": 0, + "mac_block": 45, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 51, + "device_id": 0, + "mac_block": 28, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 52, + "device_id": 0, + "mac_block": 30, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 53, + "device_id": 0, + "mac_block": 26, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 54, + "device_id": 0, + "mac_block": 23, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 55, + "device_id": 0, + "mac_block": 20, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 56, + "device_id": 0, + "mac_block": 22, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 57, + "device_id": 0, + "mac_block": 18, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 58, + "device_id": 0, + "mac_block": 44, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 59, + "device_id": 0, + "mac_block": 39, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 60, + "device_id": 0, + "mac_block": 42, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 61, + "device_id": 0, + "mac_block": 37, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 62, + "device_id": 0, + "mac_block": 36, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 63, + "device_id": 0, + "mac_block": 31, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 64, + "device_id": 0, + "mac_block": 34, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane1": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane2": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + }, + "lane3": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 1, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 65, + "device_id": 0, + "mac_block": 64, + "media_type": "copper", + "lane0": { + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 66, + "device_id": 0, + "mac_block": 64, + "media_type": "copper", + "lane0": { + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 67, + "device_id": 0, + "mac_block": 64, + "media_type": "copper", + "lane0": { + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + }, + { + "connector": 68, + "device_id": 0, + "mac_block": 64, + "media_type": "copper", + "lane0": { + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "serdes_params": { + "tx_eq_pre": 2, + "tx_eq_post": 4, + "tx_eq_attn": 0 + } + } + } + ] +} \ No newline at end of file diff --git a/device/arista/x86_64-arista_7170_64c/Arista-7170-Q59S20/port_config.ini b/device/arista/x86_64-arista_7170_64c/Arista-7170-Q59S20/port_config.ini new file mode 100644 index 000000000000..c12c9c5b83b2 --- /dev/null +++ b/device/arista/x86_64-arista_7170_64c/Arista-7170-Q59S20/port_config.ini @@ -0,0 +1,80 @@ +# name lanes alias speed index +Ethernet0 0,1,2,3 Ethernet1/1 40000 1 +Ethernet4 4,5,6,7 Ethernet2/1 40000 2 +Ethernet8 8,9,10,11 Ethernet3/1 40000 3 +Ethernet12 12,13,14,15 Ethernet4/1 40000 4 +Ethernet16 16,17,18,19 Ethernet5/1 40000 5 +Ethernet20 20,21,22,23 Ethernet6/1 40000 6 +Ethernet24 24,25,26,27 Ethernet7/1 40000 7 +Ethernet28 28,29,30,31 Ethernet8/1 40000 8 +Ethernet32 32,33,34,35 Ethernet9/1 40000 9 +Ethernet36 36,37,38,39 Ethernet10/1 40000 10 +Ethernet40 40,41,42,43 Ethernet11/1 40000 11 +Ethernet44 44,45,46,47 Ethernet12/1 40000 12 +Ethernet48 48,49,50,51 Ethernet13/1 40000 13 +Ethernet52 52,53,54,55 Ethernet14/1 40000 14 +Ethernet56 56,57,58,59 Ethernet15/1 40000 15 +Ethernet60 60,61,62,63 Ethernet16/1 40000 16 +Ethernet64 64,65,66,67 Ethernet17/1 40000 17 +Ethernet68 68,69,70,71 Ethernet18/1 40000 18 +Ethernet72 72,73,74,75 Ethernet19/1 40000 19 +Ethernet76 76,77,78,79 Ethernet20/1 40000 20 +Ethernet80 80 Ethernet21/1 10000 21 +Ethernet80 81 Ethernet21/2 10000 22 +Ethernet80 82 Ethernet21/3 10000 23 +Ethernet80 83 Ethernet21/4 10000 24 +Ethernet84 84 Ethernet22/1 10000 25 +Ethernet84 85 Ethernet22/2 10000 26 +Ethernet84 86 Ethernet22/3 10000 27 +Ethernet84 87 Ethernet22/4 10000 28 +Ethernet88 88,89,90,91 Ethernet23/1 40000 29 +Ethernet92 92,93,94,95 Ethernet24/1 40000 30 +Ethernet96 96,97,98,99 Ethernet25/1 40000 31 +Ethernet100 100,101,102,103 Ethernet26/1 40000 32 +Ethernet104 104,105,106,107 Ethernet27/1 40000 33 +Ethernet108 108,109,110,111 Ethernet28/1 40000 34 +Ethernet112 112,113,114,115 Ethernet29/1 40000 35 +Ethernet116 116,117,118,119 Ethernet30/1 40000 36 +Ethernet120 120,121,122,123 Ethernet31/1 40000 37 +Ethernet124 124,125,126,127 Ethernet32/1 40000 38 +Ethernet128 128 Ethernet33/1 10000 39 +Ethernet129 129 Ethernet33/2 10000 40 +Ethernet130 130 Ethernet33/3 10000 41 +Ethernet131 131 Ethernet33/4 10000 42 +Ethernet132 132 Ethernet34/1 10000 43 +Ethernet133 133 Ethernet34/2 10000 44 +Ethernet134 134 Ethernet34/3 10000 45 +Ethernet135 135 Ethernet34/4 10000 46 +Ethernet136 136 Ethernet35/1 10000 47 +Ethernet137 137 Ethernet35/2 10000 48 +Ethernet138 138 Ethernet35/3 10000 49 +Ethernet139 139 Ethernet35/4 10000 50 +Ethernet140 140,141,142,143 Ethernet36/1 40000 51 +Ethernet144 144,145,146,147 Ethernet37/1 40000 52 +Ethernet148 148,149,150,151 Ethernet38/1 40000 53 +Ethernet152 152,153,154,155 Ethernet39/1 40000 54 +Ethernet156 156,157,158,159 Ethernet40/1 40000 55 +Ethernet160 160,161,162,163 Ethernet41/1 40000 56 +Ethernet164 164,165,166,167 Ethernet42/1 40000 57 +Ethernet168 168,169,170,171 Ethernet43/1 40000 58 +Ethernet172 172,173,174,175 Ethernet44/1 40000 59 +Ethernet176 176,177,178,179 Ethernet45/1 40000 60 +Ethernet180 180,181,182,183 Ethernet46/1 40000 61 +Ethernet184 184,185,186,187 Ethernet47/1 40000 62 +Ethernet188 188,189,190,191 Ethernet48/1 40000 63 +Ethernet192 192,193,194,195 Ethernet49/1 40000 64 +Ethernet196 196,197,198,199 Ethernet50/1 40000 65 +Ethernet200 200,201,202,203 Ethernet51/1 40000 66 +Ethernet204 204,205,206,207 Ethernet52/1 40000 67 +Ethernet208 208,209,210,211 Ethernet53/1 40000 68 +Ethernet212 212,213,214,215 Ethernet54/1 40000 69 +Ethernet216 216,217,218,219 Ethernet55/1 40000 70 +Ethernet220 220,221,222,223 Ethernet56/1 40000 71 +Ethernet224 224,225,226,227 Ethernet57/1 40000 72 +Ethernet228 228,229,230,231 Ethernet58/1 40000 73 +Ethernet232 232,233,234,235 Ethernet59/1 40000 74 +Ethernet236 236,237,238,239 Ethernet60/1 40000 75 +Ethernet240 240,241,242,243 Ethernet61/1 40000 76 +Ethernet244 244,245,246,247 Ethernet62/1 40000 77 +Ethernet248 248,249,250,251 Ethernet63/1 40000 78 +Ethernet252 252,253,254,255 Ethernet64/1 40000 79 diff --git a/device/arista/x86_64-arista_7170_64c/Arista-7170-Q59S20/switch-sai.conf b/device/arista/x86_64-arista_7170_64c/Arista-7170-Q59S20/switch-sai.conf new file mode 100644 index 000000000000..f64f5f88ec1b --- /dev/null +++ b/device/arista/x86_64-arista_7170_64c/Arista-7170-Q59S20/switch-sai.conf @@ -0,0 +1,32 @@ +{ + "chip_list": [ + { + "id": "asic-0", + "chip_family": "Tofino", + "instance": 0, + "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:1c.4/0000:07:00.0", + "pcie_domain": 0, + "pcie_bus": 7, + "pcie_fn": 0, + "pcie_dev": 0, + "pcie_int_mode": 1, + "sds_fw_path": "share/tofino_sds_fw/avago/firmware" + } + ], + "instance": 0, + "p4_program_list": [ + { + "id": "pgm-0", + "instance": 0, + "path": "switch", + "program-name": "switch", + "pd": "lib/tofinopd/switch/libpd.so", + "pd-thrift": "lib/tofinopd/switch/libpdthrift.so", + "table-config": "share/tofinopd/switch/context.json", + "tofino-bin": "share/tofinopd/switch/tofino.bin", + "switchapi": "lib/libswitchapi.so", + "switchsai": "lib/libswitchsai.so", + "switchapi_port_add": false + } + ] +} diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/buffers_defaults_t0.j2 index b3b8e6b13c45..a5951e156b26 100644 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/buffers_defaults_t0.j2 +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/buffers_defaults_t0.j2 @@ -18,13 +18,13 @@ {%- macro generate_buffer_pool_and_profiles() %} "BUFFER_POOL": { "ingress_lossless_pool": { - "size": "32799936", + "size": "33329088", "type": "ingress", "mode": "dynamic", - "xoff": "8356608" + "xoff": "7827456" }, "egress_lossy_pool": { - "size": "26240448", + "size": "26663272", "type": "egress", "mode": "dynamic" }, diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q44 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q44 new file mode 120000 index 000000000000..a5c923950dc8 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q44 @@ -0,0 +1 @@ +Arista-7260CX3-Q64 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers.json.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers.json.j2 new file mode 100644 index 000000000000..e6e9e844469b --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers.json.j2 @@ -0,0 +1,3 @@ +{%- set default_topo = 't0' %} +{%- include 'buffers_config.j2' %} + diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..62a6bac1c25f --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers_defaults_t0.j2 @@ -0,0 +1,46 @@ +{%- set default_cable = '5m' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,64) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "33329088", + "type": "ingress", + "mode": "dynamic", + "xoff": "7827456" + }, + "egress_lossy_pool": { + "size": "26663272", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "42349632", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"11075584" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "static_th":"10587408" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1664", + "dynamic_th":"-1" + } + }, +{%- endmacro %} diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/pg_profile_lookup.ini b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/pg_profile_lookup.ini new file mode 100644 index 000000000000..34ac8b2ca700 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/pg_profile_lookup.ini @@ -0,0 +1,11 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 40000 5m 1248 1248 56160 -3 2496 + 50000 5m 1248 1248 56160 -3 2496 + 100000 5m 1248 1248 96928 -3 2496 + 40000 40m 1248 1248 56160 -3 2496 + 50000 40m 1248 1248 56160 -3 2496 + 100000 40m 1248 1248 96928 -3 2496 + 40000 300m 1248 1248 56160 -3 2496 + 50000 300m 1248 1248 56160 -3 2496 + 100000 300m 1248 1248 96928 -3 2496 diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/port_config.ini b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/port_config.ini new file mode 100644 index 000000000000..de49cb6971a3 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/port_config.ini @@ -0,0 +1,67 @@ +# name lanes alias index speed +Ethernet0 77,78,79,80 Ethernet1/1 1 40000 +Ethernet4 65,66,67,68 Ethernet2/1 2 40000 +Ethernet8 85,86,87,88 Ethernet3/1 3 40000 +Ethernet12 89,90,91,92 Ethernet4/1 4 40000 +Ethernet16 109,110,111,112 Ethernet5/1 5 40000 +Ethernet20 97,98,99,100 Ethernet6/1 6 40000 +Ethernet24 5,6,7,8 Ethernet7/1 7 40000 +Ethernet28 13,14,15,16 Ethernet8/1 8 40000 +Ethernet32 25,26,27,28 Ethernet9/1 9 40000 +Ethernet36 21,22,23,24 Ethernet10/1 10 40000 +Ethernet40 37,38,39,40 Ethernet11/1 11 40000 +Ethernet44 45,46,47,48 Ethernet12/1 12 40000 +Ethernet48 57,58,59,60 Ethernet13/1 13 40000 +Ethernet52 53,54,55,56 Ethernet14/1 14 40000 +Ethernet56 117,118,119,120 Ethernet15/1 15 40000 +Ethernet60 121,122,123,124 Ethernet16/1 16 40000 +Ethernet64 141,142,143,144 Ethernet17/1 17 40000 +Ethernet68 133,134,135,136 Ethernet18/1 18 40000 +Ethernet72 197,198,199,200 Ethernet19/1 19 40000 +Ethernet76 205,206,207,208 Ethernet20/1 20 40000 +Ethernet80 217,218,219,220 Ethernet21/1 21 40000 +Ethernet84 213,214,215,216 Ethernet22/1 22 40000 +Ethernet88 229,230,231,232 Ethernet23/1 23 40000 +Ethernet92 237,238,239,240 Ethernet24/1 24 40000 +Ethernet96 249,250,251,252 Ethernet25/1 25 40000 +Ethernet100 245,246,247,248 Ethernet26/1 26 40000 +Ethernet104 149,150,151,152 Ethernet27/1 27 40000 +Ethernet108 153,154,155,156 Ethernet28/1 28 40000 +Ethernet112 173,174,175,176 Ethernet29/1 29 40000 +Ethernet116 161,162,163,164 Ethernet30/1 30 40000 +Ethernet120 181,182,183,184 Ethernet31/1 31 40000 +Ethernet124 185,186,187,188 Ethernet32/1 32 40000 +Ethernet128 69,70,71,72 Ethernet33/1 33 40000 +Ethernet132 73,74,75,76 Ethernet34/1 34 40000 +Ethernet136 93,94,95,96 Ethernet35/1 35 40000 +Ethernet140 81,82,83,84 Ethernet36/1 36 40000 +Ethernet144 101,102,103,104 Ethernet37/1 37 40000 +Ethernet148 105,106,107,108 Ethernet38/1 38 40000 +Ethernet152 9,10,11,12 Ethernet39/1 39 40000 +Ethernet156 1,2,3,4 Ethernet40/1 40 40000 +Ethernet160 17,18,19,20 Ethernet41/1 41 40000 +Ethernet164 29,30,31,32 Ethernet42/1 42 40000 +Ethernet168 41,42,43,44 Ethernet43/1 43 40000 +Ethernet172 33,34,35,36 Ethernet44/1 44 40000 +Ethernet176 49,50,51,52 Ethernet45/1 45 40000 +Ethernet180 61,62,63,64 Ethernet46/1 46 40000 +Ethernet184 125,126,127,128 Ethernet47/1 47 40000 +Ethernet188 113,114,115,116 Ethernet48/1 48 40000 +Ethernet192 129,130,131,132 Ethernet49/1 49 40000 +Ethernet196 137,138,139,140 Ethernet50/1 50 40000 +Ethernet200 201,202,203,204 Ethernet51/1 51 40000 +Ethernet204 193,194,195,196 Ethernet52/1 52 40000 +Ethernet208 209,210,211,212 Ethernet53/1 53 40000 +Ethernet212 221,222,223,224 Ethernet54/1 54 40000 +Ethernet216 233,234,235,236 Ethernet55/1 55 40000 +Ethernet220 225,226,227,228 Ethernet56/1 56 40000 +Ethernet224 241,242,243,244 Ethernet57/1 57 40000 +Ethernet228 253,254,255,256 Ethernet58/1 58 40000 +Ethernet232 157,158,159,160 Ethernet59/1 59 40000 +Ethernet236 145,146,147,148 Ethernet60/1 60 40000 +Ethernet240 165,166,167,168 Ethernet61/1 61 40000 +Ethernet244 169,170,171,172 Ethernet62/1 62 40000 +Ethernet248 189,190,191,192 Ethernet63/1 63 40000 +Ethernet252 177,178,179,180 Ethernet64/1 64 40000 +Ethernet256 257 Ethernet65 65 10000 +Ethernet260 259 Ethernet66 66 10000 diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/qos.json.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/qos.json.j2 new file mode 100644 index 000000000000..3e548325ea30 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/qos.json.j2 @@ -0,0 +1 @@ +{%- include 'qos_config.j2' %} diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/sai.profile b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/sai.profile new file mode 100644 index 000000000000..db64a26b47da --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th2-a7260cx3-64-64x40G.config.bcm diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/th2-a7260cx3-64-64x40G.config.bcm b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/th2-a7260cx3-64-64x40G.config.bcm new file mode 100644 index 000000000000..8a6c1a28e54f --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/th2-a7260cx3-64-64x40G.config.bcm @@ -0,0 +1,1014 @@ +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 +cdma_timeout_usec=15000000 +core_clock_frequency=1700 +dma_desc_timeout_usec=15000000 +dpp_clock_ratio=2:3 +higig2_hdr_mode=1 +ipv6_lpm_128b_enable=1 +l3_alpm_enable=2 +lpm_scaling_enable=0 +l2xmsg_mode=1 +max_vp_lags=0 +mem_scan_enable=1 +miim_intr_enable=0 +module_64ports=1 +os=unix +oversubscribe_mode=1 +pbmp_xport_xe=0x40003ffff0000ffffc0003fffe0001fffe +phy_an_allow_pll_change_hg=0 +phy_an_c73_100=1 +phy_an_c73_102=1 +phy_an_c73_103=1 +phy_an_c73_104=1 +phy_an_c73_105=1 +phy_an_c73_106=1 +phy_an_c73_107=1 +phy_an_c73_108=1 +phy_an_c73_109=1 +phy_an_c73_10=1 +phy_an_c73_110=1 +phy_an_c73_111=1 +phy_an_c73_112=1 +phy_an_c73_113=1 +phy_an_c73_114=1 +phy_an_c73_115=1 +phy_an_c73_116=1 +phy_an_c73_117=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_1=1 +phy_an_c73_2=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_3=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_4=1 +phy_an_c73_5=1 +phy_an_c73_66=1 +phy_an_c73_68=1 +phy_an_c73_69=1 +phy_an_c73_6=1 +phy_an_c73_70=1 +phy_an_c73_71=1 +phy_an_c73_72=1 +phy_an_c73_73=1 +phy_an_c73_74=1 +phy_an_c73_75=1 +phy_an_c73_76=1 +phy_an_c73_77=1 +phy_an_c73_78=1 +phy_an_c73_79=1 +phy_an_c73_7=1 +phy_an_c73_80=1 +phy_an_c73_81=1 +phy_an_c73_82=1 +phy_an_c73_83=1 +phy_an_c73_8=1 +phy_an_c73_9=1 +phy_chain_rx_lane_map_physical{1.0}=0x3210 +phy_chain_rx_lane_map_physical{101.0}=0x0123 +phy_chain_rx_lane_map_physical{105.0}=0x0123 +phy_chain_rx_lane_map_physical{109.0}=0x0123 +phy_chain_rx_lane_map_physical{113.0}=0x2301 +phy_chain_rx_lane_map_physical{117.0}=0x3210 +phy_chain_rx_lane_map_physical{121.0}=0x3210 +phy_chain_rx_lane_map_physical{125.0}=0x1203 +phy_chain_rx_lane_map_physical{129.0}=0x3210 +phy_chain_rx_lane_map_physical{13.0}=0x0321 +phy_chain_rx_lane_map_physical{133.0}=0x1032 +phy_chain_rx_lane_map_physical{137.0}=0x3210 +phy_chain_rx_lane_map_physical{141.0}=0x0123 +phy_chain_rx_lane_map_physical{145.0}=0x3210 +phy_chain_rx_lane_map_physical{149.0}=0x2310 +phy_chain_rx_lane_map_physical{153.0}=0x0132 +phy_chain_rx_lane_map_physical{157.0}=0x1302 +phy_chain_rx_lane_map_physical{161.0}=0x3021 +phy_chain_rx_lane_map_physical{165.0}=0x2031 +phy_chain_rx_lane_map_physical{169.0}=0x2031 +phy_chain_rx_lane_map_physical{17.0}=0x3210 +phy_chain_rx_lane_map_physical{173.0}=0x1302 +phy_chain_rx_lane_map_physical{177.0}=0x2031 +phy_chain_rx_lane_map_physical{181.0}=0x0213 +phy_chain_rx_lane_map_physical{185.0}=0x0213 +phy_chain_rx_lane_map_physical{189.0}=0x1302 +phy_chain_rx_lane_map_physical{193.0}=0x3120 +phy_chain_rx_lane_map_physical{197.0}=0x0231 +phy_chain_rx_lane_map_physical{201.0}=0x2031 +phy_chain_rx_lane_map_physical{205.0}=0x0213 +phy_chain_rx_lane_map_physical{209.0}=0x2013 +phy_chain_rx_lane_map_physical{21.0}=0x3021 +phy_chain_rx_lane_map_physical{213.0}=0x3021 +phy_chain_rx_lane_map_physical{217.0}=0x0231 +phy_chain_rx_lane_map_physical{221.0}=0x2031 +phy_chain_rx_lane_map_physical{225.0}=0x1203 +phy_chain_rx_lane_map_physical{229.0}=0x1230 +phy_chain_rx_lane_map_physical{233.0}=0x3021 +phy_chain_rx_lane_map_physical{237.0}=0x1032 +phy_chain_rx_lane_map_physical{241.0}=0x2301 +phy_chain_rx_lane_map_physical{245.0}=0x0321 +phy_chain_rx_lane_map_physical{249.0}=0x2301 +phy_chain_rx_lane_map_physical{25.0}=0x2301 +phy_chain_rx_lane_map_physical{253.0}=0x2301 +phy_chain_rx_lane_map_physical{257.0}=0x3210 +phy_chain_rx_lane_map_physical{29.0}=0x3021 +phy_chain_rx_lane_map_physical{33.0}=0x1302 +phy_chain_rx_lane_map_physical{37.0}=0x2031 +phy_chain_rx_lane_map_physical{41.0}=0x3021 +phy_chain_rx_lane_map_physical{45.0}=0x1023 +phy_chain_rx_lane_map_physical{49.0}=0x0213 +phy_chain_rx_lane_map_physical{5.0}=0x3201 +phy_chain_rx_lane_map_physical{53.0}=0x3201 +phy_chain_rx_lane_map_physical{57.0}=0x2013 +phy_chain_rx_lane_map_physical{61.0}=0x0213 +phy_chain_rx_lane_map_physical{65.0}=0x1203 +phy_chain_rx_lane_map_physical{69.0}=0x0213 +phy_chain_rx_lane_map_physical{73.0}=0x0213 +phy_chain_rx_lane_map_physical{77.0}=0x3120 +phy_chain_rx_lane_map_physical{81.0}=0x0213 +phy_chain_rx_lane_map_physical{85.0}=0x2031 +phy_chain_rx_lane_map_physical{89.0}=0x2031 +phy_chain_rx_lane_map_physical{9.0}=0x0321 +phy_chain_rx_lane_map_physical{93.0}=0x3120 +phy_chain_rx_lane_map_physical{97.0}=0x1203 +phy_chain_rx_polarity_flip_physical{1.0}=0x1 +phy_chain_rx_polarity_flip_physical{10.0}=0x0 +phy_chain_rx_polarity_flip_physical{100.0}=0x1 +phy_chain_rx_polarity_flip_physical{101.0}=0x1 +phy_chain_rx_polarity_flip_physical{102.0}=0x0 +phy_chain_rx_polarity_flip_physical{103.0}=0x1 +phy_chain_rx_polarity_flip_physical{104.0}=0x0 +phy_chain_rx_polarity_flip_physical{105.0}=0x1 +phy_chain_rx_polarity_flip_physical{106.0}=0x0 +phy_chain_rx_polarity_flip_physical{107.0}=0x1 +phy_chain_rx_polarity_flip_physical{108.0}=0x0 +phy_chain_rx_polarity_flip_physical{109.0}=0x0 +phy_chain_rx_polarity_flip_physical{11.0}=0x1 +phy_chain_rx_polarity_flip_physical{110.0}=0x1 +phy_chain_rx_polarity_flip_physical{111.0}=0x0 +phy_chain_rx_polarity_flip_physical{112.0}=0x1 +phy_chain_rx_polarity_flip_physical{113.0}=0x1 +phy_chain_rx_polarity_flip_physical{114.0}=0x0 +phy_chain_rx_polarity_flip_physical{115.0}=0x1 +phy_chain_rx_polarity_flip_physical{116.0}=0x0 +phy_chain_rx_polarity_flip_physical{117.0}=0x0 +phy_chain_rx_polarity_flip_physical{118.0}=0x0 +phy_chain_rx_polarity_flip_physical{119.0}=0x1 +phy_chain_rx_polarity_flip_physical{12.0}=0x1 +phy_chain_rx_polarity_flip_physical{120.0}=0x0 +phy_chain_rx_polarity_flip_physical{121.0}=0x1 +phy_chain_rx_polarity_flip_physical{122.0}=0x0 +phy_chain_rx_polarity_flip_physical{123.0}=0x1 +phy_chain_rx_polarity_flip_physical{124.0}=0x0 +phy_chain_rx_polarity_flip_physical{125.0}=0x0 +phy_chain_rx_polarity_flip_physical{126.0}=0x1 +phy_chain_rx_polarity_flip_physical{127.0}=0x1 +phy_chain_rx_polarity_flip_physical{128.0}=0x1 +phy_chain_rx_polarity_flip_physical{129.0}=0x0 +phy_chain_rx_polarity_flip_physical{13.0}=0x1 +phy_chain_rx_polarity_flip_physical{130.0}=0x1 +phy_chain_rx_polarity_flip_physical{131.0}=0x1 +phy_chain_rx_polarity_flip_physical{132.0}=0x0 +phy_chain_rx_polarity_flip_physical{133.0}=0x1 +phy_chain_rx_polarity_flip_physical{134.0}=0x1 +phy_chain_rx_polarity_flip_physical{135.0}=0x1 +phy_chain_rx_polarity_flip_physical{136.0}=0x0 +phy_chain_rx_polarity_flip_physical{137.0}=0x0 +phy_chain_rx_polarity_flip_physical{138.0}=0x0 +phy_chain_rx_polarity_flip_physical{139.0}=0x1 +phy_chain_rx_polarity_flip_physical{14.0}=0x0 +phy_chain_rx_polarity_flip_physical{140.0}=0x0 +phy_chain_rx_polarity_flip_physical{141.0}=0x1 +phy_chain_rx_polarity_flip_physical{142.0}=0x0 +phy_chain_rx_polarity_flip_physical{143.0}=0x1 +phy_chain_rx_polarity_flip_physical{144.0}=0x0 +phy_chain_rx_polarity_flip_physical{145.0}=0x1 +phy_chain_rx_polarity_flip_physical{146.0}=0x0 +phy_chain_rx_polarity_flip_physical{147.0}=0x1 +phy_chain_rx_polarity_flip_physical{148.0}=0x0 +phy_chain_rx_polarity_flip_physical{149.0}=0x0 +phy_chain_rx_polarity_flip_physical{15.0}=0x1 +phy_chain_rx_polarity_flip_physical{150.0}=0x1 +phy_chain_rx_polarity_flip_physical{151.0}=0x1 +phy_chain_rx_polarity_flip_physical{152.0}=0x0 +phy_chain_rx_polarity_flip_physical{153.0}=0x0 +phy_chain_rx_polarity_flip_physical{154.0}=0x1 +phy_chain_rx_polarity_flip_physical{155.0}=0x1 +phy_chain_rx_polarity_flip_physical{156.0}=0x0 +phy_chain_rx_polarity_flip_physical{157.0}=0x0 +phy_chain_rx_polarity_flip_physical{158.0}=0x0 +phy_chain_rx_polarity_flip_physical{159.0}=0x1 +phy_chain_rx_polarity_flip_physical{16.0}=0x0 +phy_chain_rx_polarity_flip_physical{160.0}=0x0 +phy_chain_rx_polarity_flip_physical{161.0}=0x1 +phy_chain_rx_polarity_flip_physical{162.0}=0x1 +phy_chain_rx_polarity_flip_physical{163.0}=0x0 +phy_chain_rx_polarity_flip_physical{164.0}=0x1 +phy_chain_rx_polarity_flip_physical{165.0}=0x0 +phy_chain_rx_polarity_flip_physical{166.0}=0x0 +phy_chain_rx_polarity_flip_physical{167.0}=0x1 +phy_chain_rx_polarity_flip_physical{168.0}=0x1 +phy_chain_rx_polarity_flip_physical{169.0}=0x1 +phy_chain_rx_polarity_flip_physical{17.0}=0x1 +phy_chain_rx_polarity_flip_physical{170.0}=0x1 +phy_chain_rx_polarity_flip_physical{171.0}=0x0 +phy_chain_rx_polarity_flip_physical{172.0}=0x0 +phy_chain_rx_polarity_flip_physical{173.0}=0x0 +phy_chain_rx_polarity_flip_physical{174.0}=0x0 +phy_chain_rx_polarity_flip_physical{175.0}=0x1 +phy_chain_rx_polarity_flip_physical{176.0}=0x1 +phy_chain_rx_polarity_flip_physical{177.0}=0x1 +phy_chain_rx_polarity_flip_physical{178.0}=0x1 +phy_chain_rx_polarity_flip_physical{179.0}=0x0 +phy_chain_rx_polarity_flip_physical{18.0}=0x0 +phy_chain_rx_polarity_flip_physical{180.0}=0x0 +phy_chain_rx_polarity_flip_physical{181.0}=0x1 +phy_chain_rx_polarity_flip_physical{182.0}=0x1 +phy_chain_rx_polarity_flip_physical{183.0}=0x0 +phy_chain_rx_polarity_flip_physical{184.0}=0x0 +phy_chain_rx_polarity_flip_physical{185.0}=0x0 +phy_chain_rx_polarity_flip_physical{186.0}=0x0 +phy_chain_rx_polarity_flip_physical{187.0}=0x1 +phy_chain_rx_polarity_flip_physical{188.0}=0x1 +phy_chain_rx_polarity_flip_physical{189.0}=0x0 +phy_chain_rx_polarity_flip_physical{19.0}=0x1 +phy_chain_rx_polarity_flip_physical{190.0}=0x0 +phy_chain_rx_polarity_flip_physical{191.0}=0x1 +phy_chain_rx_polarity_flip_physical{192.0}=0x0 +phy_chain_rx_polarity_flip_physical{193.0}=0x0 +phy_chain_rx_polarity_flip_physical{194.0}=0x0 +phy_chain_rx_polarity_flip_physical{195.0}=0x1 +phy_chain_rx_polarity_flip_physical{196.0}=0x1 +phy_chain_rx_polarity_flip_physical{197.0}=0x1 +phy_chain_rx_polarity_flip_physical{198.0}=0x1 +phy_chain_rx_polarity_flip_physical{199.0}=0x0 +phy_chain_rx_polarity_flip_physical{2.0}=0x0 +phy_chain_rx_polarity_flip_physical{20.0}=0x0 +phy_chain_rx_polarity_flip_physical{200.0}=0x0 +phy_chain_rx_polarity_flip_physical{201.0}=0x0 +phy_chain_rx_polarity_flip_physical{202.0}=0x0 +phy_chain_rx_polarity_flip_physical{203.0}=0x1 +phy_chain_rx_polarity_flip_physical{204.0}=0x0 +phy_chain_rx_polarity_flip_physical{205.0}=0x1 +phy_chain_rx_polarity_flip_physical{206.0}=0x1 +phy_chain_rx_polarity_flip_physical{207.0}=0x0 +phy_chain_rx_polarity_flip_physical{208.0}=0x0 +phy_chain_rx_polarity_flip_physical{209.0}=0x1 +phy_chain_rx_polarity_flip_physical{21.0}=0x0 +phy_chain_rx_polarity_flip_physical{210.0}=0x1 +phy_chain_rx_polarity_flip_physical{211.0}=0x0 +phy_chain_rx_polarity_flip_physical{212.0}=0x0 +phy_chain_rx_polarity_flip_physical{213.0}=0x0 +phy_chain_rx_polarity_flip_physical{214.0}=0x0 +phy_chain_rx_polarity_flip_physical{215.0}=0x1 +phy_chain_rx_polarity_flip_physical{216.0}=0x0 +phy_chain_rx_polarity_flip_physical{217.0}=0x0 +phy_chain_rx_polarity_flip_physical{218.0}=0x0 +phy_chain_rx_polarity_flip_physical{219.0}=0x1 +phy_chain_rx_polarity_flip_physical{22.0}=0x0 +phy_chain_rx_polarity_flip_physical{220.0}=0x1 +phy_chain_rx_polarity_flip_physical{221.0}=0x0 +phy_chain_rx_polarity_flip_physical{222.0}=0x0 +phy_chain_rx_polarity_flip_physical{223.0}=0x1 +phy_chain_rx_polarity_flip_physical{224.0}=0x1 +phy_chain_rx_polarity_flip_physical{225.0}=0x1 +phy_chain_rx_polarity_flip_physical{226.0}=0x0 +phy_chain_rx_polarity_flip_physical{227.0}=0x0 +phy_chain_rx_polarity_flip_physical{228.0}=0x1 +phy_chain_rx_polarity_flip_physical{229.0}=0x0 +phy_chain_rx_polarity_flip_physical{23.0}=0x1 +phy_chain_rx_polarity_flip_physical{230.0}=0x0 +phy_chain_rx_polarity_flip_physical{231.0}=0x1 +phy_chain_rx_polarity_flip_physical{232.0}=0x1 +phy_chain_rx_polarity_flip_physical{233.0}=0x1 +phy_chain_rx_polarity_flip_physical{234.0}=0x0 +phy_chain_rx_polarity_flip_physical{235.0}=0x0 +phy_chain_rx_polarity_flip_physical{236.0}=0x0 +phy_chain_rx_polarity_flip_physical{237.0}=0x1 +phy_chain_rx_polarity_flip_physical{238.0}=0x0 +phy_chain_rx_polarity_flip_physical{239.0}=0x1 +phy_chain_rx_polarity_flip_physical{24.0}=0x0 +phy_chain_rx_polarity_flip_physical{240.0}=0x0 +phy_chain_rx_polarity_flip_physical{241.0}=0x1 +phy_chain_rx_polarity_flip_physical{242.0}=0x0 +phy_chain_rx_polarity_flip_physical{243.0}=0x1 +phy_chain_rx_polarity_flip_physical{244.0}=0x0 +phy_chain_rx_polarity_flip_physical{245.0}=0x1 +phy_chain_rx_polarity_flip_physical{246.0}=0x1 +phy_chain_rx_polarity_flip_physical{247.0}=0x1 +phy_chain_rx_polarity_flip_physical{248.0}=0x0 +phy_chain_rx_polarity_flip_physical{249.0}=0x0 +phy_chain_rx_polarity_flip_physical{25.0}=0x1 +phy_chain_rx_polarity_flip_physical{250.0}=0x1 +phy_chain_rx_polarity_flip_physical{251.0}=0x0 +phy_chain_rx_polarity_flip_physical{252.0}=0x1 +phy_chain_rx_polarity_flip_physical{253.0}=0x1 +phy_chain_rx_polarity_flip_physical{254.0}=0x0 +phy_chain_rx_polarity_flip_physical{255.0}=0x1 +phy_chain_rx_polarity_flip_physical{256.0}=0x0 +phy_chain_rx_polarity_flip_physical{257.0}=0x0 +phy_chain_rx_polarity_flip_physical{259.0}=0x0 +phy_chain_rx_polarity_flip_physical{26.0}=0x0 +phy_chain_rx_polarity_flip_physical{27.0}=0x1 +phy_chain_rx_polarity_flip_physical{28.0}=0x0 +phy_chain_rx_polarity_flip_physical{29.0}=0x0 +phy_chain_rx_polarity_flip_physical{3.0}=0x1 +phy_chain_rx_polarity_flip_physical{30.0}=0x0 +phy_chain_rx_polarity_flip_physical{31.0}=0x0 +phy_chain_rx_polarity_flip_physical{32.0}=0x1 +phy_chain_rx_polarity_flip_physical{33.0}=0x0 +phy_chain_rx_polarity_flip_physical{34.0}=0x0 +phy_chain_rx_polarity_flip_physical{35.0}=0x1 +phy_chain_rx_polarity_flip_physical{36.0}=0x1 +phy_chain_rx_polarity_flip_physical{37.0}=0x1 +phy_chain_rx_polarity_flip_physical{38.0}=0x1 +phy_chain_rx_polarity_flip_physical{39.0}=0x0 +phy_chain_rx_polarity_flip_physical{4.0}=0x0 +phy_chain_rx_polarity_flip_physical{40.0}=0x0 +phy_chain_rx_polarity_flip_physical{41.0}=0x0 +phy_chain_rx_polarity_flip_physical{42.0}=0x1 +phy_chain_rx_polarity_flip_physical{43.0}=0x1 +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}=0x1 +phy_chain_rx_polarity_flip_physical{5.0}=0x1 +phy_chain_rx_polarity_flip_physical{50.0}=0x1 +phy_chain_rx_polarity_flip_physical{51.0}=0x0 +phy_chain_rx_polarity_flip_physical{52.0}=0x0 +phy_chain_rx_polarity_flip_physical{53.0}=0x0 +phy_chain_rx_polarity_flip_physical{54.0}=0x0 +phy_chain_rx_polarity_flip_physical{55.0}=0x1 +phy_chain_rx_polarity_flip_physical{56.0}=0x0 +phy_chain_rx_polarity_flip_physical{57.0}=0x0 +phy_chain_rx_polarity_flip_physical{58.0}=0x0 +phy_chain_rx_polarity_flip_physical{59.0}=0x1 +phy_chain_rx_polarity_flip_physical{6.0}=0x0 +phy_chain_rx_polarity_flip_physical{60.0}=0x1 +phy_chain_rx_polarity_flip_physical{61.0}=0x0 +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}=0x1 +phy_chain_rx_polarity_flip_physical{65.0}=0x1 +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{7.0}=0x0 +phy_chain_rx_polarity_flip_physical{70.0}=0x0 +phy_chain_rx_polarity_flip_physical{71.0}=0x1 +phy_chain_rx_polarity_flip_physical{72.0}=0x1 +phy_chain_rx_polarity_flip_physical{73.0}=0x1 +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}=0x0 +phy_chain_rx_polarity_flip_physical{77.0}=0x0 +phy_chain_rx_polarity_flip_physical{78.0}=0x0 +phy_chain_rx_polarity_flip_physical{79.0}=0x1 +phy_chain_rx_polarity_flip_physical{8.0}=0x1 +phy_chain_rx_polarity_flip_physical{80.0}=0x1 +phy_chain_rx_polarity_flip_physical{81.0}=0x1 +phy_chain_rx_polarity_flip_physical{82.0}=0x1 +phy_chain_rx_polarity_flip_physical{83.0}=0x0 +phy_chain_rx_polarity_flip_physical{84.0}=0x0 +phy_chain_rx_polarity_flip_physical{85.0}=0x1 +phy_chain_rx_polarity_flip_physical{86.0}=0x1 +phy_chain_rx_polarity_flip_physical{87.0}=0x0 +phy_chain_rx_polarity_flip_physical{88.0}=0x0 +phy_chain_rx_polarity_flip_physical{89.0}=0x0 +phy_chain_rx_polarity_flip_physical{9.0}=0x1 +phy_chain_rx_polarity_flip_physical{90.0}=0x0 +phy_chain_rx_polarity_flip_physical{91.0}=0x1 +phy_chain_rx_polarity_flip_physical{92.0}=0x1 +phy_chain_rx_polarity_flip_physical{93.0}=0x0 +phy_chain_rx_polarity_flip_physical{94.0}=0x0 +phy_chain_rx_polarity_flip_physical{95.0}=0x1 +phy_chain_rx_polarity_flip_physical{96.0}=0x0 +phy_chain_rx_polarity_flip_physical{97.0}=0x1 +phy_chain_rx_polarity_flip_physical{98.0}=0x1 +phy_chain_rx_polarity_flip_physical{99.0}=0x0 +phy_chain_tx_lane_map_physical{1.0}=0x2031 +phy_chain_tx_lane_map_physical{101.0}=0x1023 +phy_chain_tx_lane_map_physical{105.0}=0x1302 +phy_chain_tx_lane_map_physical{109.0}=0x0321 +phy_chain_tx_lane_map_physical{113.0}=0x2301 +phy_chain_tx_lane_map_physical{117.0}=0x3120 +phy_chain_tx_lane_map_physical{121.0}=0x3102 +phy_chain_tx_lane_map_physical{125.0}=0x3210 +phy_chain_tx_lane_map_physical{129.0}=0x1023 +phy_chain_tx_lane_map_physical{13.0}=0x3021 +phy_chain_tx_lane_map_physical{133.0}=0x3210 +phy_chain_tx_lane_map_physical{137.0}=0x2031 +phy_chain_tx_lane_map_physical{141.0}=0x1302 +phy_chain_tx_lane_map_physical{145.0}=0x3210 +phy_chain_tx_lane_map_physical{149.0}=0x0213 +phy_chain_tx_lane_map_physical{153.0}=0x3210 +phy_chain_tx_lane_map_physical{157.0}=0x1320 +phy_chain_tx_lane_map_physical{161.0}=0x3210 +phy_chain_tx_lane_map_physical{165.0}=0x0231 +phy_chain_tx_lane_map_physical{169.0}=0x3120 +phy_chain_tx_lane_map_physical{17.0}=0x1032 +phy_chain_tx_lane_map_physical{173.0}=0x0312 +phy_chain_tx_lane_map_physical{177.0}=0x0231 +phy_chain_tx_lane_map_physical{181.0}=0x3210 +phy_chain_tx_lane_map_physical{185.0}=0x3210 +phy_chain_tx_lane_map_physical{189.0}=0x1320 +phy_chain_tx_lane_map_physical{193.0}=0x0321 +phy_chain_tx_lane_map_physical{197.0}=0x3120 +phy_chain_tx_lane_map_physical{201.0}=0x3120 +phy_chain_tx_lane_map_physical{205.0}=0x0123 +phy_chain_tx_lane_map_physical{209.0}=0x3120 +phy_chain_tx_lane_map_physical{21.0}=0x0213 +phy_chain_tx_lane_map_physical{213.0}=0x3021 +phy_chain_tx_lane_map_physical{217.0}=0x0312 +phy_chain_tx_lane_map_physical{221.0}=0x2301 +phy_chain_tx_lane_map_physical{225.0}=0x0123 +phy_chain_tx_lane_map_physical{229.0}=0x2031 +phy_chain_tx_lane_map_physical{233.0}=0x0231 +phy_chain_tx_lane_map_physical{237.0}=0x0213 +phy_chain_tx_lane_map_physical{241.0}=0x1320 +phy_chain_tx_lane_map_physical{245.0}=0x2031 +phy_chain_tx_lane_map_physical{249.0}=0x3120 +phy_chain_tx_lane_map_physical{25.0}=0x0231 +phy_chain_tx_lane_map_physical{253.0}=0x0321 +phy_chain_tx_lane_map_physical{257.0}=0x3210 +phy_chain_tx_lane_map_physical{29.0}=0x1230 +phy_chain_tx_lane_map_physical{33.0}=0x1032 +phy_chain_tx_lane_map_physical{37.0}=0x0123 +phy_chain_tx_lane_map_physical{41.0}=0x0213 +phy_chain_tx_lane_map_physical{45.0}=0x0132 +phy_chain_tx_lane_map_physical{49.0}=0x2031 +phy_chain_tx_lane_map_physical{5.0}=0x2301 +phy_chain_tx_lane_map_physical{53.0}=0x2301 +phy_chain_tx_lane_map_physical{57.0}=0x2031 +phy_chain_tx_lane_map_physical{61.0}=0x2031 +phy_chain_tx_lane_map_physical{65.0}=0x1230 +phy_chain_tx_lane_map_physical{69.0}=0x2013 +phy_chain_tx_lane_map_physical{73.0}=0x0213 +phy_chain_tx_lane_map_physical{77.0}=0x2310 +phy_chain_tx_lane_map_physical{81.0}=0x0321 +phy_chain_tx_lane_map_physical{85.0}=0x2013 +phy_chain_tx_lane_map_physical{89.0}=0x0213 +phy_chain_tx_lane_map_physical{9.0}=0x3012 +phy_chain_tx_lane_map_physical{93.0}=0x3102 +phy_chain_tx_lane_map_physical{97.0}=0x3210 +phy_chain_tx_polarity_flip_physical{1.0}=0x0 +phy_chain_tx_polarity_flip_physical{10.0}=0x1 +phy_chain_tx_polarity_flip_physical{100.0}=0x0 +phy_chain_tx_polarity_flip_physical{101.0}=0x0 +phy_chain_tx_polarity_flip_physical{102.0}=0x1 +phy_chain_tx_polarity_flip_physical{103.0}=0x0 +phy_chain_tx_polarity_flip_physical{104.0}=0x0 +phy_chain_tx_polarity_flip_physical{105.0}=0x0 +phy_chain_tx_polarity_flip_physical{106.0}=0x1 +phy_chain_tx_polarity_flip_physical{107.0}=0x1 +phy_chain_tx_polarity_flip_physical{108.0}=0x1 +phy_chain_tx_polarity_flip_physical{109.0}=0x0 +phy_chain_tx_polarity_flip_physical{11.0}=0x1 +phy_chain_tx_polarity_flip_physical{110.0}=0x0 +phy_chain_tx_polarity_flip_physical{111.0}=0x0 +phy_chain_tx_polarity_flip_physical{112.0}=0x1 +phy_chain_tx_polarity_flip_physical{113.0}=0x1 +phy_chain_tx_polarity_flip_physical{114.0}=0x1 +phy_chain_tx_polarity_flip_physical{115.0}=0x1 +phy_chain_tx_polarity_flip_physical{116.0}=0x0 +phy_chain_tx_polarity_flip_physical{117.0}=0x1 +phy_chain_tx_polarity_flip_physical{118.0}=0x0 +phy_chain_tx_polarity_flip_physical{119.0}=0x0 +phy_chain_tx_polarity_flip_physical{12.0}=0x0 +phy_chain_tx_polarity_flip_physical{120.0}=0x0 +phy_chain_tx_polarity_flip_physical{121.0}=0x0 +phy_chain_tx_polarity_flip_physical{122.0}=0x0 +phy_chain_tx_polarity_flip_physical{123.0}=0x0 +phy_chain_tx_polarity_flip_physical{124.0}=0x1 +phy_chain_tx_polarity_flip_physical{125.0}=0x0 +phy_chain_tx_polarity_flip_physical{126.0}=0x1 +phy_chain_tx_polarity_flip_physical{127.0}=0x1 +phy_chain_tx_polarity_flip_physical{128.0}=0x1 +phy_chain_tx_polarity_flip_physical{129.0}=0x1 +phy_chain_tx_polarity_flip_physical{13.0}=0x0 +phy_chain_tx_polarity_flip_physical{130.0}=0x0 +phy_chain_tx_polarity_flip_physical{131.0}=0x1 +phy_chain_tx_polarity_flip_physical{132.0}=0x0 +phy_chain_tx_polarity_flip_physical{133.0}=0x1 +phy_chain_tx_polarity_flip_physical{134.0}=0x1 +phy_chain_tx_polarity_flip_physical{135.0}=0x1 +phy_chain_tx_polarity_flip_physical{136.0}=0x1 +phy_chain_tx_polarity_flip_physical{137.0}=0x1 +phy_chain_tx_polarity_flip_physical{138.0}=0x1 +phy_chain_tx_polarity_flip_physical{139.0}=0x1 +phy_chain_tx_polarity_flip_physical{14.0}=0x1 +phy_chain_tx_polarity_flip_physical{140.0}=0x1 +phy_chain_tx_polarity_flip_physical{141.0}=0x0 +phy_chain_tx_polarity_flip_physical{142.0}=0x1 +phy_chain_tx_polarity_flip_physical{143.0}=0x1 +phy_chain_tx_polarity_flip_physical{144.0}=0x1 +phy_chain_tx_polarity_flip_physical{145.0}=0x1 +phy_chain_tx_polarity_flip_physical{146.0}=0x1 +phy_chain_tx_polarity_flip_physical{147.0}=0x1 +phy_chain_tx_polarity_flip_physical{148.0}=0x0 +phy_chain_tx_polarity_flip_physical{149.0}=0x1 +phy_chain_tx_polarity_flip_physical{15.0}=0x0 +phy_chain_tx_polarity_flip_physical{150.0}=0x0 +phy_chain_tx_polarity_flip_physical{151.0}=0x0 +phy_chain_tx_polarity_flip_physical{152.0}=0x0 +phy_chain_tx_polarity_flip_physical{153.0}=0x1 +phy_chain_tx_polarity_flip_physical{154.0}=0x0 +phy_chain_tx_polarity_flip_physical{155.0}=0x0 +phy_chain_tx_polarity_flip_physical{156.0}=0x0 +phy_chain_tx_polarity_flip_physical{157.0}=0x0 +phy_chain_tx_polarity_flip_physical{158.0}=0x0 +phy_chain_tx_polarity_flip_physical{159.0}=0x0 +phy_chain_tx_polarity_flip_physical{16.0}=0x0 +phy_chain_tx_polarity_flip_physical{160.0}=0x0 +phy_chain_tx_polarity_flip_physical{161.0}=0x0 +phy_chain_tx_polarity_flip_physical{162.0}=0x1 +phy_chain_tx_polarity_flip_physical{163.0}=0x1 +phy_chain_tx_polarity_flip_physical{164.0}=0x0 +phy_chain_tx_polarity_flip_physical{165.0}=0x1 +phy_chain_tx_polarity_flip_physical{166.0}=0x1 +phy_chain_tx_polarity_flip_physical{167.0}=0x1 +phy_chain_tx_polarity_flip_physical{168.0}=0x0 +phy_chain_tx_polarity_flip_physical{169.0}=0x0 +phy_chain_tx_polarity_flip_physical{17.0}=0x0 +phy_chain_tx_polarity_flip_physical{170.0}=0x1 +phy_chain_tx_polarity_flip_physical{171.0}=0x1 +phy_chain_tx_polarity_flip_physical{172.0}=0x1 +phy_chain_tx_polarity_flip_physical{173.0}=0x0 +phy_chain_tx_polarity_flip_physical{174.0}=0x0 +phy_chain_tx_polarity_flip_physical{175.0}=0x1 +phy_chain_tx_polarity_flip_physical{176.0}=0x0 +phy_chain_tx_polarity_flip_physical{177.0}=0x1 +phy_chain_tx_polarity_flip_physical{178.0}=0x0 +phy_chain_tx_polarity_flip_physical{179.0}=0x0 +phy_chain_tx_polarity_flip_physical{18.0}=0x1 +phy_chain_tx_polarity_flip_physical{180.0}=0x0 +phy_chain_tx_polarity_flip_physical{181.0}=0x0 +phy_chain_tx_polarity_flip_physical{182.0}=0x0 +phy_chain_tx_polarity_flip_physical{183.0}=0x0 +phy_chain_tx_polarity_flip_physical{184.0}=0x1 +phy_chain_tx_polarity_flip_physical{185.0}=0x0 +phy_chain_tx_polarity_flip_physical{186.0}=0x1 +phy_chain_tx_polarity_flip_physical{187.0}=0x1 +phy_chain_tx_polarity_flip_physical{188.0}=0x1 +phy_chain_tx_polarity_flip_physical{189.0}=0x0 +phy_chain_tx_polarity_flip_physical{19.0}=0x1 +phy_chain_tx_polarity_flip_physical{190.0}=0x0 +phy_chain_tx_polarity_flip_physical{191.0}=0x0 +phy_chain_tx_polarity_flip_physical{192.0}=0x0 +phy_chain_tx_polarity_flip_physical{193.0}=0x1 +phy_chain_tx_polarity_flip_physical{194.0}=0x1 +phy_chain_tx_polarity_flip_physical{195.0}=0x1 +phy_chain_tx_polarity_flip_physical{196.0}=0x0 +phy_chain_tx_polarity_flip_physical{197.0}=0x0 +phy_chain_tx_polarity_flip_physical{198.0}=0x1 +phy_chain_tx_polarity_flip_physical{199.0}=0x1 +phy_chain_tx_polarity_flip_physical{2.0}=0x1 +phy_chain_tx_polarity_flip_physical{20.0}=0x1 +phy_chain_tx_polarity_flip_physical{200.0}=0x1 +phy_chain_tx_polarity_flip_physical{201.0}=0x1 +phy_chain_tx_polarity_flip_physical{202.0}=0x1 +phy_chain_tx_polarity_flip_physical{203.0}=0x1 +phy_chain_tx_polarity_flip_physical{204.0}=0x1 +phy_chain_tx_polarity_flip_physical{205.0}=0x0 +phy_chain_tx_polarity_flip_physical{206.0}=0x1 +phy_chain_tx_polarity_flip_physical{207.0}=0x1 +phy_chain_tx_polarity_flip_physical{208.0}=0x1 +phy_chain_tx_polarity_flip_physical{209.0}=0x1 +phy_chain_tx_polarity_flip_physical{21.0}=0x0 +phy_chain_tx_polarity_flip_physical{210.0}=0x1 +phy_chain_tx_polarity_flip_physical{211.0}=0x1 +phy_chain_tx_polarity_flip_physical{212.0}=0x0 +phy_chain_tx_polarity_flip_physical{213.0}=0x0 +phy_chain_tx_polarity_flip_physical{214.0}=0x1 +phy_chain_tx_polarity_flip_physical{215.0}=0x0 +phy_chain_tx_polarity_flip_physical{216.0}=0x1 +phy_chain_tx_polarity_flip_physical{217.0}=0x1 +phy_chain_tx_polarity_flip_physical{218.0}=0x1 +phy_chain_tx_polarity_flip_physical{219.0}=0x0 +phy_chain_tx_polarity_flip_physical{22.0}=0x0 +phy_chain_tx_polarity_flip_physical{220.0}=0x1 +phy_chain_tx_polarity_flip_physical{221.0}=0x0 +phy_chain_tx_polarity_flip_physical{222.0}=0x0 +phy_chain_tx_polarity_flip_physical{223.0}=0x0 +phy_chain_tx_polarity_flip_physical{224.0}=0x1 +phy_chain_tx_polarity_flip_physical{225.0}=0x1 +phy_chain_tx_polarity_flip_physical{226.0}=0x1 +phy_chain_tx_polarity_flip_physical{227.0}=0x1 +phy_chain_tx_polarity_flip_physical{228.0}=0x0 +phy_chain_tx_polarity_flip_physical{229.0}=0x0 +phy_chain_tx_polarity_flip_physical{23.0}=0x0 +phy_chain_tx_polarity_flip_physical{230.0}=0x1 +phy_chain_tx_polarity_flip_physical{231.0}=0x1 +phy_chain_tx_polarity_flip_physical{232.0}=0x1 +phy_chain_tx_polarity_flip_physical{233.0}=0x0 +phy_chain_tx_polarity_flip_physical{234.0}=0x0 +phy_chain_tx_polarity_flip_physical{235.0}=0x0 +phy_chain_tx_polarity_flip_physical{236.0}=0x0 +phy_chain_tx_polarity_flip_physical{237.0}=0x1 +phy_chain_tx_polarity_flip_physical{238.0}=0x1 +phy_chain_tx_polarity_flip_physical{239.0}=0x1 +phy_chain_tx_polarity_flip_physical{24.0}=0x0 +phy_chain_tx_polarity_flip_physical{240.0}=0x0 +phy_chain_tx_polarity_flip_physical{241.0}=0x1 +phy_chain_tx_polarity_flip_physical{242.0}=0x1 +phy_chain_tx_polarity_flip_physical{243.0}=0x1 +phy_chain_tx_polarity_flip_physical{244.0}=0x0 +phy_chain_tx_polarity_flip_physical{245.0}=0x1 +phy_chain_tx_polarity_flip_physical{246.0}=0x1 +phy_chain_tx_polarity_flip_physical{247.0}=0x1 +phy_chain_tx_polarity_flip_physical{248.0}=0x1 +phy_chain_tx_polarity_flip_physical{249.0}=0x1 +phy_chain_tx_polarity_flip_physical{25.0}=0x1 +phy_chain_tx_polarity_flip_physical{250.0}=0x0 +phy_chain_tx_polarity_flip_physical{251.0}=0x0 +phy_chain_tx_polarity_flip_physical{252.0}=0x0 +phy_chain_tx_polarity_flip_physical{253.0}=0x1 +phy_chain_tx_polarity_flip_physical{254.0}=0x1 +phy_chain_tx_polarity_flip_physical{255.0}=0x1 +phy_chain_tx_polarity_flip_physical{256.0}=0x0 +phy_chain_tx_polarity_flip_physical{257.0}=0x0 +phy_chain_tx_polarity_flip_physical{259.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}=0x1 +phy_chain_tx_polarity_flip_physical{3.0}=0x1 +phy_chain_tx_polarity_flip_physical{30.0}=0x1 +phy_chain_tx_polarity_flip_physical{31.0}=0x1 +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}=0x1 +phy_chain_tx_polarity_flip_physical{37.0}=0x1 +phy_chain_tx_polarity_flip_physical{38.0}=0x1 +phy_chain_tx_polarity_flip_physical{39.0}=0x1 +phy_chain_tx_polarity_flip_physical{4.0}=0x1 +phy_chain_tx_polarity_flip_physical{40.0}=0x0 +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}=0x1 +phy_chain_tx_polarity_flip_physical{46.0}=0x0 +phy_chain_tx_polarity_flip_physical{47.0}=0x1 +phy_chain_tx_polarity_flip_physical{48.0}=0x1 +phy_chain_tx_polarity_flip_physical{49.0}=0x0 +phy_chain_tx_polarity_flip_physical{5.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}=0x1 +phy_chain_tx_polarity_flip_physical{53.0}=0x0 +phy_chain_tx_polarity_flip_physical{54.0}=0x1 +phy_chain_tx_polarity_flip_physical{55.0}=0x1 +phy_chain_tx_polarity_flip_physical{56.0}=0x0 +phy_chain_tx_polarity_flip_physical{57.0}=0x0 +phy_chain_tx_polarity_flip_physical{58.0}=0x1 +phy_chain_tx_polarity_flip_physical{59.0}=0x1 +phy_chain_tx_polarity_flip_physical{6.0}=0x1 +phy_chain_tx_polarity_flip_physical{60.0}=0x1 +phy_chain_tx_polarity_flip_physical{61.0}=0x0 +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}=0x1 +phy_chain_tx_polarity_flip_physical{65.0}=0x0 +phy_chain_tx_polarity_flip_physical{66.0}=0x1 +phy_chain_tx_polarity_flip_physical{67.0}=0x1 +phy_chain_tx_polarity_flip_physical{68.0}=0x0 +phy_chain_tx_polarity_flip_physical{69.0}=0x1 +phy_chain_tx_polarity_flip_physical{7.0}=0x1 +phy_chain_tx_polarity_flip_physical{70.0}=0x1 +phy_chain_tx_polarity_flip_physical{71.0}=0x1 +phy_chain_tx_polarity_flip_physical{72.0}=0x0 +phy_chain_tx_polarity_flip_physical{73.0}=0x1 +phy_chain_tx_polarity_flip_physical{74.0}=0x0 +phy_chain_tx_polarity_flip_physical{75.0}=0x0 +phy_chain_tx_polarity_flip_physical{76.0}=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}=0x1 +phy_chain_tx_polarity_flip_physical{8.0}=0x0 +phy_chain_tx_polarity_flip_physical{80.0}=0x0 +phy_chain_tx_polarity_flip_physical{81.0}=0x1 +phy_chain_tx_polarity_flip_physical{82.0}=0x1 +phy_chain_tx_polarity_flip_physical{83.0}=0x1 +phy_chain_tx_polarity_flip_physical{84.0}=0x0 +phy_chain_tx_polarity_flip_physical{85.0}=0x1 +phy_chain_tx_polarity_flip_physical{86.0}=0x0 +phy_chain_tx_polarity_flip_physical{87.0}=0x0 +phy_chain_tx_polarity_flip_physical{88.0}=0x0 +phy_chain_tx_polarity_flip_physical{89.0}=0x1 +phy_chain_tx_polarity_flip_physical{9.0}=0x0 +phy_chain_tx_polarity_flip_physical{90.0}=0x1 +phy_chain_tx_polarity_flip_physical{91.0}=0x1 +phy_chain_tx_polarity_flip_physical{92.0}=0x0 +phy_chain_tx_polarity_flip_physical{93.0}=0x0 +phy_chain_tx_polarity_flip_physical{94.0}=0x0 +phy_chain_tx_polarity_flip_physical{95.0}=0x0 +phy_chain_tx_polarity_flip_physical{96.0}=0x0 +phy_chain_tx_polarity_flip_physical{97.0}=0x0 +phy_chain_tx_polarity_flip_physical{98.0}=0x1 +phy_chain_tx_polarity_flip_physical{99.0}=0x1 +port_init_autoneg_100=0 +port_init_autoneg_102=0 +port_init_autoneg_103=0 +port_init_autoneg_104=0 +port_init_autoneg_105=0 +port_init_autoneg_106=0 +port_init_autoneg_107=0 +port_init_autoneg_108=0 +port_init_autoneg_109=0 +port_init_autoneg_10=0 +port_init_autoneg_110=0 +port_init_autoneg_111=0 +port_init_autoneg_112=0 +port_init_autoneg_113=0 +port_init_autoneg_114=0 +port_init_autoneg_115=0 +port_init_autoneg_116=0 +port_init_autoneg_117=0 +port_init_autoneg_11=0 +port_init_autoneg_12=0 +port_init_autoneg_13=0 +port_init_autoneg_14=0 +port_init_autoneg_15=0 +port_init_autoneg_16=0 +port_init_autoneg_1=0 +port_init_autoneg_2=0 +port_init_autoneg_34=0 +port_init_autoneg_35=0 +port_init_autoneg_36=0 +port_init_autoneg_37=0 +port_init_autoneg_38=0 +port_init_autoneg_39=0 +port_init_autoneg_3=0 +port_init_autoneg_40=0 +port_init_autoneg_41=0 +port_init_autoneg_42=0 +port_init_autoneg_43=0 +port_init_autoneg_44=0 +port_init_autoneg_45=0 +port_init_autoneg_46=0 +port_init_autoneg_47=0 +port_init_autoneg_48=0 +port_init_autoneg_49=0 +port_init_autoneg_4=0 +port_init_autoneg_5=0 +port_init_autoneg_66=0 +port_init_autoneg_68=0 +port_init_autoneg_69=0 +port_init_autoneg_6=0 +port_init_autoneg_70=0 +port_init_autoneg_71=0 +port_init_autoneg_72=0 +port_init_autoneg_73=0 +port_init_autoneg_74=0 +port_init_autoneg_75=0 +port_init_autoneg_76=0 +port_init_autoneg_77=0 +port_init_autoneg_78=0 +port_init_autoneg_79=0 +port_init_autoneg_7=0 +port_init_autoneg_80=0 +port_init_autoneg_81=0 +port_init_autoneg_82=0 +port_init_autoneg_83=0 +port_init_autoneg_8=0 +port_init_autoneg_9=0 +port_init_cl72_hg=1 +port_phy_addr_100=0xff +port_phy_addr_102=0xff +port_phy_addr_103=0xff +port_phy_addr_104=0xff +port_phy_addr_105=0xff +port_phy_addr_106=0xff +port_phy_addr_107=0xff +port_phy_addr_108=0xff +port_phy_addr_109=0xff +port_phy_addr_10=0xff +port_phy_addr_110=0xff +port_phy_addr_111=0xff +port_phy_addr_112=0xff +port_phy_addr_113=0xff +port_phy_addr_114=0xff +port_phy_addr_115=0xff +port_phy_addr_116=0xff +port_phy_addr_117=0xff +port_phy_addr_11=0xff +port_phy_addr_12=0xff +port_phy_addr_13=0xff +port_phy_addr_14=0xff +port_phy_addr_15=0xff +port_phy_addr_16=0xff +port_phy_addr_1=0xff +port_phy_addr_2=0xff +port_phy_addr_34=0xff +port_phy_addr_35=0xff +port_phy_addr_36=0xff +port_phy_addr_37=0xff +port_phy_addr_38=0xff +port_phy_addr_39=0xff +port_phy_addr_3=0xff +port_phy_addr_40=0xff +port_phy_addr_41=0xff +port_phy_addr_42=0xff +port_phy_addr_43=0xff +port_phy_addr_44=0xff +port_phy_addr_45=0xff +port_phy_addr_46=0xff +port_phy_addr_47=0xff +port_phy_addr_48=0xff +port_phy_addr_49=0xff +port_phy_addr_4=0xff +port_phy_addr_5=0xff +port_phy_addr_66=0xff +port_phy_addr_68=0xff +port_phy_addr_69=0xff +port_phy_addr_6=0xff +port_phy_addr_70=0xff +port_phy_addr_71=0xff +port_phy_addr_72=0xff +port_phy_addr_73=0xff +port_phy_addr_74=0xff +port_phy_addr_75=0xff +port_phy_addr_76=0xff +port_phy_addr_77=0xff +port_phy_addr_78=0xff +port_phy_addr_79=0xff +port_phy_addr_7=0xff +port_phy_addr_80=0xff +port_phy_addr_81=0xff +port_phy_addr_82=0xff +port_phy_addr_83=0xff +port_phy_addr_8=0xff +port_phy_addr_9=0xff +portmap_100=259:10 +portmap_101=262:10 +portmap_102=217:40 +portmap_103=213:40 +portmap_104=229:40 +portmap_105=237:40 +portmap_106=249:40 +portmap_107=245:40 +portmap_108=209:40 +portmap_109=221:40 +portmap_10=29:40 +portmap_110=233:40 +portmap_111=225:40 +portmap_112=241:40 +portmap_113=253:40 +portmap_114=197:40 +portmap_115=205:40 +portmap_116=201:40 +portmap_117=193:40 +portmap_11=41:40 +portmap_12=33:40 +portmap_134=263:10 +portmap_13=57:40 +portmap_14=53:40 +portmap_15=49:40 +portmap_16=61:40 +portmap_1=5:40 +portmap_2=13:40 +portmap_33=260:10 +portmap_34=77:40 +portmap_35=65:40 +portmap_36=85:40 +portmap_37=89:40 +portmap_38=109:40 +portmap_39=97:40 +portmap_3=25:40 +portmap_40=69:40 +portmap_41=73:40 +portmap_42=93:40 +portmap_43=81:40 +portmap_44=101:40 +portmap_45=105:40 +portmap_46=117:40 +portmap_47=121:40 +portmap_48=125:40 +portmap_49=113:40 +portmap_4=21:40 +portmap_5=37:40 +portmap_66=257:10 +portmap_67=261:10 +portmap_68=149:40 +portmap_69=153:40 +portmap_6=45:40 +portmap_70=173:40 +portmap_71=161:40 +portmap_72=181:40 +portmap_73=185:40 +portmap_74=157:40 +portmap_75=145:40 +portmap_76=165:40 +portmap_77=169:40 +portmap_78=189:40 +portmap_79=177:40 +portmap_7=9:40 +portmap_80=141:40 +portmap_81=133:40 +portmap_82=129:40 +portmap_83=137:40 +portmap_8=1:40 +portmap_9=17:40 +robust_hash_disable_egress_vlan=1 +robust_hash_disable_mpls=1 +robust_hash_disable_vlan=1 +sram_scan_enable=0 +stable_size=0x5500000 +stable_size=0x5500000 +tdma_timeout_usec=15000000 +tslam_timeout_usec=15000000 + +# tuning parameters +serdes_preemphasis_1=0x105004 +serdes_preemphasis_2=0x105004 +serdes_preemphasis_3=0x105004 +serdes_preemphasis_4=0x105004 +serdes_preemphasis_5=0x105004 +serdes_preemphasis_6=0x105004 +serdes_preemphasis_7=0x105004 +serdes_preemphasis_8=0x105004 +serdes_preemphasis_9=0x105004 +serdes_preemphasis_10=0x105004 +serdes_preemphasis_11=0x105004 +serdes_preemphasis_12=0x105004 +serdes_preemphasis_13=0x71f01 +serdes_preemphasis_14=0x72101 +serdes_preemphasis_15=0x105004 +serdes_preemphasis_16=0x105004 +serdes_preemphasis_34=0x105004 +serdes_preemphasis_35=0x105004 +serdes_preemphasis_36=0x105004 +serdes_preemphasis_37=0x105004 +serdes_preemphasis_38=0x105004 +serdes_preemphasis_39=0x105004 +serdes_preemphasis_40=0x105004 +serdes_preemphasis_41=0x105004 +serdes_preemphasis_42=0x105004 +serdes_preemphasis_43=0x105004 +serdes_preemphasis_44=0x105004 +serdes_preemphasis_45=0x105004 +serdes_preemphasis_46=0x61d01 +serdes_preemphasis_47=0x51a01 +serdes_preemphasis_48=0x105004 +serdes_preemphasis_49=0x105004 +serdes_preemphasis_66=0x62f01 +serdes_preemphasis_68=0x105004 +serdes_preemphasis_69=0x105004 +serdes_preemphasis_70=0x105004 +serdes_preemphasis_71=0x105004 +serdes_preemphasis_72=0x105004 +serdes_preemphasis_73=0x105004 +serdes_preemphasis_74=0x105004 +serdes_preemphasis_75=0x105004 +serdes_preemphasis_76=0x105004 +serdes_preemphasis_77=0x105004 +serdes_preemphasis_78=0x105004 +serdes_preemphasis_79=0x105004 +serdes_preemphasis_80=0x61d01 +serdes_preemphasis_81=0x51b01 +serdes_preemphasis_82=0x105004 +serdes_preemphasis_83=0x105004 +serdes_preemphasis_100=0x62f01 +serdes_preemphasis_102=0x105004 +serdes_preemphasis_103=0x105004 +serdes_preemphasis_104=0x105004 +serdes_preemphasis_105=0x105004 +serdes_preemphasis_106=0x105004 +serdes_preemphasis_107=0x105004 +serdes_preemphasis_108=0x105004 +serdes_preemphasis_109=0x105004 +serdes_preemphasis_110=0x105004 +serdes_preemphasis_111=0x105004 +serdes_preemphasis_112=0x105004 +serdes_preemphasis_113=0x105004 +serdes_preemphasis_114=0x61c01 +serdes_preemphasis_115=0x61c01 +serdes_preemphasis_116=0x105004 +serdes_preemphasis_117=0x105004 diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50-40/port_config.ini b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50-40/port_config.ini new file mode 100644 index 000000000000..9a2b38e6da79 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50-40/port_config.ini @@ -0,0 +1,49 @@ +# name lanes alias index speed +Ethernet0 65,66 Eth1/1 0 50000 +Ethernet2 67,68 Eth1/2 0 50000 +Ethernet4 69,70 Eth2/1 1 50000 +Ethernet6 71,72 Eth2/2 1 50000 +Ethernet8 73,74 Eth3/1 2 50000 +Ethernet10 75,76 Eth3/2 2 50000 +Ethernet12 77,78 Eth4/1 3 50000 +Ethernet14 79,80 Eth4/2 3 50000 +Ethernet16 33,34 Eth5/1 4 50000 +Ethernet18 35,36 Eth5/2 4 50000 +Ethernet20 37,38 Eth6/1 5 50000 +Ethernet22 39,40 Eth6/2 5 50000 +Ethernet24 41,42 Eth7/1 6 50000 +Ethernet26 43,44 Eth7/2 6 50000 +Ethernet28 45,46 Eth8/1 7 50000 +Ethernet30 47,48 Eth8/2 7 50000 +Ethernet32 49,50 Eth9/1 8 50000 +Ethernet34 51,52 Eth9/2 8 50000 +Ethernet36 53,54 Eth10/1 9 50000 +Ethernet38 55,56 Eth10/2 9 50000 +Ethernet40 57,58 Eth11/1 10 50000 +Ethernet42 59,60 Eth11/2 10 50000 +Ethernet44 61,62 Eth12/1 11 50000 +Ethernet46 63,64 Eth12/2 11 50000 +Ethernet48 81,82 Eth13/1 12 50000 +Ethernet50 83,84 Eth13/2 12 50000 +Ethernet52 85,86 Eth14/1 13 50000 +Ethernet54 87,88 Eth14/2 13 50000 +Ethernet56 89,90 Eth15/1 14 50000 +Ethernet58 91,92 Eth15/2 14 50000 +Ethernet60 93,94 Eth16/1 15 50000 +Ethernet62 95,96 Eth16/2 15 50000 +Ethernet64 97,98,99,100 Eth17 16 40000 +Ethernet68 101,102,103,104 Eth18 17 40000 +Ethernet72 105,106,107,108 Eth19 18 40000 +Ethernet76 109,110,111,112 Eth20 19 40000 +Ethernet80 1,2,3,4 Eth21 20 40000 +Ethernet84 5,6,7,8 Eth22 21 40000 +Ethernet88 9,10,11,12 Eth23 22 40000 +Ethernet92 13,14,15,16 Eth24 23 40000 +Ethernet96 17,18,19,20 Eth25 24 40000 +Ethernet100 21,22,23,24 Eth26 25 40000 +Ethernet104 25,26,27,28 Eth27 26 40000 +Ethernet108 29,30,31,32 Eth28 27 40000 +Ethernet112 113,114,115,116 Eth29 28 40000 +Ethernet116 117,118,119,120 Eth30 29 40000 +Ethernet120 121,122,123,124 Eth31 30 40000 +Ethernet124 125,126,127,128 Eth32 31 40000 diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50-40/sai.profile b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50-40/sai.profile new file mode 100644 index 000000000000..3ae50f718493 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50-40/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-seastone-dx010-32x50G-16x100G.config.bcm diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50-40/th-seastone-dx010-32x50G-16x100G.config.bcm b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50-40/th-seastone-dx010-32x50G-16x100G.config.bcm new file mode 100644 index 000000000000..ee9e283efe52 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50-40/th-seastone-dx010-32x50G-16x100G.config.bcm @@ -0,0 +1,499 @@ +# Define default OS / SAL +os=unix + +# all XPORTs to XE ports +#pbmp_xport_xe=0x1fffffffe +pbmp_xport_xe=0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe +pbmp_oversubscribe=0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe + +# Mode control to select L2 Table DMA mode aka L2MODE_POLL (0) or +# L2MOD_FIFO mechanism aka L2MODE_FIFO (1) for L2 table change notification. +l2xmsg_mode=1 + +# Memory table size configs, enable ALPM +l2_mem_entries=8192 +l3_mem_entries=8192 +l3_alpm_enable=2 +ipv6_lpm_128b_enable=1 + +#Use MMU lossy configuration +mmu_lossless=0 + +################################################################################### +# SeaStone customized configuration +################################################################################### + +#ext mdio frequency to 495/0x80/2(1.933Mhz) or 415/0x80/2(1.62MHz) +# default is 40 +# Set external MDIO freq to 6.19MHz (495MHz) or 5.19MHz (415MHz) +#* target_freq is core_clock_freq * DIVIDEND / DIVISOR / 2 +# +rate_ext_mdio_divisor=0x80 + +# use internal rom boot +phy_ext_rom_boot=0 + +oversubscribe_mode=1 + +# Map the physical ports to logical ports +dport_map_enable=1 + +dport_map_port_68=1 +dport_map_port_69=2 + +dport_map_port_72=5 +dport_map_port_73=6 + +dport_map_port_76=9 +dport_map_port_77=10 + +dport_map_port_80=13 +dport_map_port_81=14 + +dport_map_port_34=17 +dport_map_port_35=18 + +dport_map_port_38=21 +dport_map_port_39=22 + +dport_map_port_42=25 +dport_map_port_43=26 + +dport_map_port_46=29 +dport_map_port_47=30 + +dport_map_port_50=33 +dport_map_port_51=34 + +dport_map_port_54=37 +dport_map_port_55=38 + +dport_map_port_58=41 +dport_map_port_59=42 + +dport_map_port_62=45 +dport_map_port_63=46 + +dport_map_port_84=49 +dport_map_port_85=50 + +dport_map_port_88=53 +dport_map_port_89=54 + +dport_map_port_92=57 +dport_map_port_93=58 + +dport_map_port_96=61 +dport_map_port_97=62 + +# 100G/40G ports +dport_map_port_102=65 +dport_map_port_106=69 +dport_map_port_110=73 +dport_map_port_114=77 +dport_map_port_1=81 +dport_map_port_5=85 +dport_map_port_9=89 +dport_map_port_13=93 +dport_map_port_17=97 +dport_map_port_21=101 +dport_map_port_25=105 +dport_map_port_29=109 +dport_map_port_118=113 +dport_map_port_122=117 +dport_map_port_126=121 +dport_map_port_130=125 + + +# port/lane mapping, 32x50G + 16x100G +portmap_68=65:50:2 +portmap_69=67:50:2 + +portmap_72=69:50:2 +portmap_73=71:50:2 + +portmap_76=73:50:2 +portmap_77=75:50:2 + +portmap_80=77:50:2 +portmap_81=79:50:2 + +portmap_34=33:50:2 +portmap_35=35:50:2 + +portmap_38=37:50:2 +portmap_39=39:50:2 + +portmap_42=41:50:2 +portmap_43=43:50:2 + +portmap_46=45:50:2 +portmap_47=47:50:2 + +portmap_50=49:50:2 +portmap_51=51:50:2 + +portmap_54=53:50:2 +portmap_55=55:50:2 + +portmap_58=57:50:2 +portmap_59=59:50:2 + +portmap_62=61:50:2 +portmap_63=63:50:2 + +portmap_84=81:50:2 +portmap_85=83:50:2 + +portmap_88=85:50:2 +portmap_89=87:50:2 + +portmap_92=89:50:2 +portmap_93=91:50:2 + +portmap_96=93:50:2 +portmap_97=95:50:2 + +portmap_102=97:100:4 +portmap_106=101:100:4 +portmap_110=105:100:4 +portmap_114=109:100:4 +portmap_1=1:100:4 +portmap_5=5:100:4 +portmap_9=9:100:4 +portmap_13=13:100:4 +portmap_17=17:100:4 +portmap_21=21:100:4 +portmap_25=25:100:4 +portmap_29=29:100:4 +portmap_118=113:100:4 +portmap_122=117:100:4 +portmap_126=121:100:4 +portmap_130=125:100:4 + + +#WC16 +xgxs_tx_lane_map_68=0x3201 +xgxs_rx_lane_map_68=0x2310 +xgxs_tx_lane_map_69=0x3201 +xgxs_rx_lane_map_69=0x2310 + + +#WC17 +xgxs_tx_lane_map_72=0x3201 +xgxs_rx_lane_map_72=0x2301 +xgxs_tx_lane_map_73=0x3201 +xgxs_rx_lane_map_73=0x2301 + +#WC18 +xgxs_tx_lane_map_76=0x0132 +xgxs_rx_lane_map_76=0x0123 +xgxs_tx_lane_map_77=0x0132 +xgxs_rx_lane_map_77=0x0123 + +#WC19 +xgxs_tx_lane_map_80=0x2031 +xgxs_rx_lane_map_80=0x1320 +xgxs_tx_lane_map_81=0x2031 +xgxs_rx_lane_map_81=0x1320 + +#WC8 +xgxs_tx_lane_map_34=0x3021 +xgxs_rx_lane_map_34=0x0213 +xgxs_tx_lane_map_35=0x3021 +xgxs_rx_lane_map_35=0x0213 + +#WC9 +xgxs_tx_lane_map_38=0x3210 +xgxs_rx_lane_map_38=0x1023 +xgxs_tx_lane_map_39=0x3210 +xgxs_rx_lane_map_39=0x1023 + +#WC10 +xgxs_tx_lane_map_42=0x2310 +xgxs_rx_lane_map_42=0x3210 +xgxs_tx_lane_map_43=0x2310 +xgxs_rx_lane_map_43=0x3210 + +#WC11 +xgxs_tx_lane_map_46=0x1032 +xgxs_rx_lane_map_46=0x1302 +xgxs_tx_lane_map_47=0x1032 +xgxs_rx_lane_map_47=0x1302 + +#WC12 +xgxs_tx_lane_map_50=0x3201 +xgxs_rx_lane_map_50=0x0213 +xgxs_tx_lane_map_51=0x3201 +xgxs_rx_lane_map_51=0x0213 + + +#WC13 +xgxs_tx_lane_map_54=0x2301 +xgxs_rx_lane_map_54=0x2310 +xgxs_tx_lane_map_55=0x2301 +xgxs_rx_lane_map_55=0x2310 + +#WC14 +xgxs_tx_lane_map_58=0x3201 +xgxs_rx_lane_map_58=0x0213 +xgxs_tx_lane_map_59=0x3201 +xgxs_rx_lane_map_59=0x0213 + +#WC15 +xgxs_tx_lane_map_62=0x1302 +xgxs_rx_lane_map_62=0x2310 +xgxs_tx_lane_map_63=0x1302 +xgxs_rx_lane_map_63=0x2310 + +#WC20 +xgxs_tx_lane_map_84=0x0213 +xgxs_rx_lane_map_84=0x2301 +xgxs_tx_lane_map_85=0x0213 +xgxs_rx_lane_map_85=0x2301 + +#WC21 +xgxs_tx_lane_map_88=0x0132 +xgxs_rx_lane_map_88=0x3210 +xgxs_tx_lane_map_89=0x0132 +xgxs_rx_lane_map_89=0x3210 + +#WC22 +xgxs_tx_lane_map_92=0x0132 +xgxs_rx_lane_map_92=0x2031 +xgxs_tx_lane_map_93=0x0132 +xgxs_rx_lane_map_93=0x2031 + +#WC23 +xgxs_tx_lane_map_96=0x2031 +xgxs_rx_lane_map_96=0x3201 +xgxs_tx_lane_map_97=0x2031 +xgxs_rx_lane_map_97=0x3201 + + +#WC24 +xgxs_tx_lane_map_102=0x0132 +xgxs_rx_lane_map_102=0x2301 + +#WC25 +xgxs_tx_lane_map_106=0x0132 +xgxs_rx_lane_map_106=0x3201 + +#WC26 +xgxs_tx_lane_map_110=0x0132 +xgxs_rx_lane_map_110=0x2031 + +#WC27 +xgxs_tx_lane_map_114=0x2031 +xgxs_rx_lane_map_114=0x2301 + +#WC0 +xgxs_tx_lane_map_1=0x3210 +xgxs_rx_lane_map_1=0x3120 + +#WC1 +xgxs_tx_lane_map_5=0x0132 +xgxs_rx_lane_map_5=0x1023 + +#WC2 +xgxs_tx_lane_map_9=0x3201 +xgxs_rx_lane_map_9=0x3120 + +#WC3 +xgxs_tx_lane_map_13=0x2031 +xgxs_rx_lane_map_13=0x1032 + +#WC4 +xgxs_tx_lane_map_17=0x2310 +xgxs_rx_lane_map_17=0x3210 + +#WC5 +xgxs_tx_lane_map_21=0x2301 +xgxs_rx_lane_map_21=0x3120 + +#WC6 +xgxs_tx_lane_map_25=0x3201 +xgxs_rx_lane_map_25=0x0213 + +#WC7 +xgxs_tx_lane_map_29=0x1302 +xgxs_rx_lane_map_29=0x1023 + +#WC28 +xgxs_tx_lane_map_118=0x1320 +xgxs_rx_lane_map_118=0x1302 + +#WC29 +xgxs_tx_lane_map_122=0x1032 +xgxs_rx_lane_map_122=0x1023 + +#WC30 +xgxs_tx_lane_map_126=0x3120 +xgxs_rx_lane_map_126=0x3120 + +#WC31 +xgxs_tx_lane_map_130=0x1302 +xgxs_rx_lane_map_130=0x2310 + + +#Polarity flip settings +#WC16 +phy_xaui_tx_polarity_flip_68=0x0000 +phy_xaui_rx_polarity_flip_68=0x0000 +phy_xaui_tx_polarity_flip_69=0x0000 +phy_xaui_rx_polarity_flip_69=0x0000 + +#WC17 +phy_xaui_tx_polarity_flip_72=0x0001 +phy_xaui_rx_polarity_flip_72=0x0002 +phy_xaui_tx_polarity_flip_73=0x0003 +phy_xaui_rx_polarity_flip_73=0x0000 + +#WC18 +phy_xaui_tx_polarity_flip_76=0x0003 +phy_xaui_rx_polarity_flip_76=0x0000 +phy_xaui_tx_polarity_flip_77=0x0003 +phy_xaui_rx_polarity_flip_77=0x0000 + +#WC19 +phy_xaui_tx_polarity_flip_80=0x0003 +phy_xaui_rx_polarity_flip_80=0x0003 +phy_xaui_tx_polarity_flip_81=0x0003 +phy_xaui_rx_polarity_flip_81=0x0003 + +#WC8 +phy_xaui_tx_polarity_flip_34=0x0002 +phy_xaui_rx_polarity_flip_34=0x0000 +phy_xaui_tx_polarity_flip_35=0x0003 +phy_xaui_rx_polarity_flip_35=0x0000 + +#WC9 +phy_xaui_tx_polarity_flip_38=0x0000 +phy_xaui_rx_polarity_flip_38=0x0000 +phy_xaui_tx_polarity_flip_39=0x0002 +phy_xaui_rx_polarity_flip_39=0x0000 + +#WC10 +phy_xaui_tx_polarity_flip_42=0x0001 +phy_xaui_rx_polarity_flip_42=0x0000 +phy_xaui_tx_polarity_flip_43=0x0003 +phy_xaui_rx_polarity_flip_43=0x0000 + +#WC11 +phy_xaui_tx_polarity_flip_46=0x0000 +phy_xaui_rx_polarity_flip_46=0x0000 +phy_xaui_tx_polarity_flip_47=0x0000 +phy_xaui_rx_polarity_flip_47=0x0000 + +#WC12 +phy_xaui_tx_polarity_flip_50=0x0002 +phy_xaui_rx_polarity_flip_50=0x0000 +phy_xaui_tx_polarity_flip_51=0x0000 +phy_xaui_rx_polarity_flip_51=0x0000 + +#WC13 +phy_xaui_tx_polarity_flip_54=0x0002 +phy_xaui_rx_polarity_flip_54=0x0000 +phy_xaui_tx_polarity_flip_55=0x0000 +phy_xaui_rx_polarity_flip_55=0x0000 + +#WC14 +phy_xaui_tx_polarity_flip_58=0x0000 +phy_xaui_rx_polarity_flip_58=0x0000 +phy_xaui_tx_polarity_flip_59=0x0000 +phy_xaui_rx_polarity_flip_59=0x0000 + +#WC15 +phy_xaui_tx_polarity_flip_62=0x0002 +phy_xaui_rx_polarity_flip_62=0x0003 +phy_xaui_tx_polarity_flip_63=0x0002 +phy_xaui_rx_polarity_flip_63=0x0003 + +#WC20 +phy_xaui_tx_polarity_flip_84=0x0003 +phy_xaui_rx_polarity_flip_84=0x0002 +phy_xaui_tx_polarity_flip_85=0x0001 +phy_xaui_rx_polarity_flip_85=0x0003 + +#WC21 +phy_xaui_tx_polarity_flip_88=0x0001 +phy_xaui_rx_polarity_flip_88=0x0001 +phy_xaui_tx_polarity_flip_89=0x0003 +phy_xaui_rx_polarity_flip_89=0x0003 + +#WC22 +phy_xaui_tx_polarity_flip_92=0x0003 +phy_xaui_rx_polarity_flip_92=0x0000 +phy_xaui_tx_polarity_flip_93=0x0003 +phy_xaui_rx_polarity_flip_93=0x0002 + +#WC23 +phy_xaui_tx_polarity_flip_96=0x0001 +phy_xaui_rx_polarity_flip_96=0x0000 +phy_xaui_tx_polarity_flip_97=0x0001 +phy_xaui_rx_polarity_flip_97=0x0000 + +#WC24 +phy_xaui_tx_polarity_flip_102=0x0000 +phy_xaui_rx_polarity_flip_102=0x000F + +#WC25 +phy_xaui_tx_polarity_flip_106=0x000F +phy_xaui_rx_polarity_flip_106=0x0000 + +#WC26 +phy_xaui_tx_polarity_flip_110=0x000F +phy_xaui_rx_polarity_flip_110=0x000F + +#WC27 +phy_xaui_tx_polarity_flip_114=0x000F +phy_xaui_rx_polarity_flip_114=0x0007 + +#WC0 +phy_xaui_tx_polarity_flip_1=0x0003 +phy_xaui_rx_polarity_flip_1=0x000F + +#WC1 +phy_xaui_tx_polarity_flip_5=0x0007 +phy_xaui_rx_polarity_flip_5=0x0000 + +#WC2 +phy_xaui_tx_polarity_flip_9=0x0002 +phy_xaui_rx_polarity_flip_9=0x0008 + +#WC3 +phy_xaui_tx_polarity_flip_13=0x000F +phy_xaui_rx_polarity_flip_13=0x0000 + +#WC4 +phy_xaui_tx_polarity_flip_17=0x0007 +phy_xaui_rx_polarity_flip_17=0x0000 + +#WC5 +phy_xaui_tx_polarity_flip_21=0x0000 +phy_xaui_rx_polarity_flip_21=0x0000 + +#WC6 +phy_xaui_tx_polarity_flip_25=0x0002 +phy_xaui_rx_polarity_flip_25=0x0005 + +#WC7 +phy_xaui_tx_polarity_flip_29=0x0002 +phy_xaui_rx_polarity_flip_29=0x0000 + +#WC28 +phy_xaui_tx_polarity_flip_118=0x000F +phy_xaui_rx_polarity_flip_118=0x000F + +#WC29 +phy_xaui_tx_polarity_flip_122=0x0004 +phy_xaui_rx_polarity_flip_122=0x0000 + +#WC30 +phy_xaui_tx_polarity_flip_126=0x000F +phy_xaui_rx_polarity_flip_126=0x0000 + +#WC31 +phy_xaui_tx_polarity_flip_130=0x0006 +phy_xaui_rx_polarity_flip_130=0x0000 + diff --git a/device/celestica/x86_64-cel_seastone-r0/led-code/ledcode0 b/device/celestica/x86_64-cel_seastone-r0/led-code/ledcode0 index df26e4abd679..829087013a2a 100755 --- a/device/celestica/x86_64-cel_seastone-r0/led-code/ledcode0 +++ b/device/celestica/x86_64-cel_seastone-r0/led-code/ledcode0 @@ -1,13 +1,16 @@ -02 20 28 67 72 12 30 80 D1 74 02 02 00 28 67 72 -12 20 80 D1 74 0D 02 30 28 67 72 02 31 28 67 72 -02 32 28 67 72 02 33 28 67 72 02 34 28 67 72 02 -35 28 67 72 02 36 28 67 72 02 37 28 67 72 02 38 -28 67 72 02 39 28 67 72 02 3A 28 67 72 02 3B 28 -67 72 02 3C 28 67 72 02 3D 28 67 72 02 3E 28 67 -72 02 3F 28 67 72 12 E0 85 05 D2 05 71 70 52 00 -3A 80 67 98 75 B0 77 78 67 9F 75 7E 77 8B 28 67 -A6 75 B6 16 E0 DA 04 74 B0 77 B6 28 67 A6 75 B3 -16 E0 DA 04 74 B0 77 B3 12 A0 F8 15 1A 00 57 12 -A0 F8 15 1A 01 57 28 32 00 32 01 B7 97 77 AF 57 -67 B9 57 67 C7 57 67 C0 57 32 0F 87 32 0F 87 57 -32 0F 87 32 0E 87 57 32 0E 87 32 0E 87 57 00 00 + 02 20 28 67 2A 12 30 D1 74 02 02 00 28 67 2A 12 + 20 D1 74 0C 02 30 28 67 2A 12 40 D1 74 16 12 E0 + 85 05 D2 05 71 28 52 00 3A 80 67 7C 75 30 77 42 + 67 83 75 36 77 53 67 8A 75 3C 77 42 67 91 75 64 + 77 64 67 75 75 A9 28 67 9F 75 B4 16 E0 DA 04 74 + A9 77 B4 67 75 75 BF 28 67 9F 75 C6 16 E0 DA 04 + 74 BF 77 C6 67 75 75 CD 28 67 9F 75 D2 16 E0 DA + 04 74 CD 77 D2 12 A0 F8 15 1A 00 57 12 A0 F8 15 + 1A 01 57 12 A0 F8 15 1A 02 57 12 A0 F8 15 1A 03 + 57 12 A0 F8 15 1A 04 57 12 A0 F8 15 1A 05 57 28 + 32 00 32 01 B7 97 77 A8 57 67 D7 67 DE 67 DE 67 + DE F2 04 57 67 E5 67 DE 67 DE 67 DE F2 04 57 67 + D7 67 DE F2 02 57 67 E5 67 DE F2 02 57 67 D7 F2 + 01 57 67 E5 F2 01 57 32 0F 87 32 0F 87 57 32 0F + 87 32 0E 87 57 32 0E 87 32 0E 87 57 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 diff --git a/device/celestica/x86_64-cel_seastone-r0/led-code/ledcode1 b/device/celestica/x86_64-cel_seastone-r0/led-code/ledcode1 index df26e4abd679..829087013a2a 100755 --- a/device/celestica/x86_64-cel_seastone-r0/led-code/ledcode1 +++ b/device/celestica/x86_64-cel_seastone-r0/led-code/ledcode1 @@ -1,13 +1,16 @@ -02 20 28 67 72 12 30 80 D1 74 02 02 00 28 67 72 -12 20 80 D1 74 0D 02 30 28 67 72 02 31 28 67 72 -02 32 28 67 72 02 33 28 67 72 02 34 28 67 72 02 -35 28 67 72 02 36 28 67 72 02 37 28 67 72 02 38 -28 67 72 02 39 28 67 72 02 3A 28 67 72 02 3B 28 -67 72 02 3C 28 67 72 02 3D 28 67 72 02 3E 28 67 -72 02 3F 28 67 72 12 E0 85 05 D2 05 71 70 52 00 -3A 80 67 98 75 B0 77 78 67 9F 75 7E 77 8B 28 67 -A6 75 B6 16 E0 DA 04 74 B0 77 B6 28 67 A6 75 B3 -16 E0 DA 04 74 B0 77 B3 12 A0 F8 15 1A 00 57 12 -A0 F8 15 1A 01 57 28 32 00 32 01 B7 97 77 AF 57 -67 B9 57 67 C7 57 67 C0 57 32 0F 87 32 0F 87 57 -32 0F 87 32 0E 87 57 32 0E 87 32 0E 87 57 00 00 + 02 20 28 67 2A 12 30 D1 74 02 02 00 28 67 2A 12 + 20 D1 74 0C 02 30 28 67 2A 12 40 D1 74 16 12 E0 + 85 05 D2 05 71 28 52 00 3A 80 67 7C 75 30 77 42 + 67 83 75 36 77 53 67 8A 75 3C 77 42 67 91 75 64 + 77 64 67 75 75 A9 28 67 9F 75 B4 16 E0 DA 04 74 + A9 77 B4 67 75 75 BF 28 67 9F 75 C6 16 E0 DA 04 + 74 BF 77 C6 67 75 75 CD 28 67 9F 75 D2 16 E0 DA + 04 74 CD 77 D2 12 A0 F8 15 1A 00 57 12 A0 F8 15 + 1A 01 57 12 A0 F8 15 1A 02 57 12 A0 F8 15 1A 03 + 57 12 A0 F8 15 1A 04 57 12 A0 F8 15 1A 05 57 28 + 32 00 32 01 B7 97 77 A8 57 67 D7 67 DE 67 DE 67 + DE F2 04 57 67 E5 67 DE 67 DE 67 DE F2 04 57 67 + D7 67 DE F2 02 57 67 E5 67 DE F2 02 57 67 D7 F2 + 01 57 67 E5 F2 01 57 32 0F 87 32 0F 87 57 32 0F + 87 32 0E 87 57 32 0E 87 32 0E 87 57 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers_defaults_t0.j2 b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..38e34eb571e8 --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers_defaults_t0.j2 @@ -0,0 +1,45 @@ +{%- 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": "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/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers_defaults_t1.j2 b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers_defaults_t1.j2 index 40d32ef316da..38e34eb571e8 100644 --- a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers_defaults_t1.j2 +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers_defaults_t1.j2 @@ -20,7 +20,7 @@ "mode": "static" }, "egress_lossy_pool": { - "size": "7582515", + "size": "7326924", "type": "egress", "mode": "dynamic" } diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/pg_profile_lookup.ini b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/pg_profile_lookup.ini index 135a598465ba..9f2eacb6fc42 100644 --- a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/pg_profile_lookup.ini +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/pg_profile_lookup.ini @@ -1,11 +1,17 @@ # PG lossless profiles. # speed cable size xon xoff threshold xon_offset - 40000 5m 41808 18432 40560 -3 2496 - 50000 5m 41808 18432 40560 -3 2496 - 100000 5m 41808 18432 40560 -3 2496 - 40000 40m 51376 18432 50128 -3 2496 - 50000 40m 51376 18432 50128 -3 2496 - 100000 40m 51376 18432 50128 -3 2496 - 40000 300m 51376 18432 50128 -3 2496 - 50000 300m 51376 18432 50128 -3 2496 - 100000 300m 51376 18432 50128 -3 2496 + 10000 5m 56368 18432 55120 -3 2496 + 25000 5m 56368 18432 55120 -3 2496 + 40000 5m 56368 18432 55120 -3 2496 + 50000 5m 56368 18432 55120 -3 2496 + 100000 5m 56368 18432 55120 -3 2496 + 10000 40m 56368 18432 55120 -3 2496 + 25000 40m 56368 18432 55120 -3 2496 + 40000 40m 56368 18432 55120 -3 2496 + 50000 40m 56368 18432 55120 -3 2496 + 100000 40m 56368 18432 55120 -3 2496 + 10000 300m 56368 18432 55120 -3 2496 + 25000 300m 56368 18432 55120 -3 2496 + 40000 300m 56368 18432 55120 -3 2496 + 50000 300m 56368 18432 55120 -3 2496 + 100000 300m 56368 18432 55120 -3 2496 diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t0.j2 b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t0.j2 index e337f676b650..f949a31eab7b 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t0.j2 +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t0.j2 @@ -11,13 +11,13 @@ {%- macro generate_buffer_pool_and_profiles() %} "BUFFER_POOL": { "ingress_lossless_pool": { - "size": "11213696", + "size": "10875072", "type": "ingress", "mode": "dynamic", - "xoff": "3855488" + "xoff": "4194112" }, "egress_lossy_pool": { - "size": "9532224", + "size": "9243812", "type": "egress", "mode": "dynamic" }, diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t1.j2 b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t1.j2 index c7c98bfe4299..e56bbb65845f 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t1.j2 +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t1.j2 @@ -11,13 +11,13 @@ {%- macro generate_buffer_pool_and_profiles() %} "BUFFER_POOL": { "ingress_lossless_pool": { - "size": "10443264", + "size": "10875072", "type": "ingress", "mode": "dynamic", - "xoff": "4625920" + "xoff": "4194112" }, "egress_lossy_pool": { - "size": "8877440", + "size": "9243812", "type": "egress", "mode": "dynamic" }, diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/pg_profile_lookup.ini b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/pg_profile_lookup.ini index 570454c8d5b2..dc05d0a100a3 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/pg_profile_lookup.ini +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/pg_profile_lookup.ini @@ -13,5 +13,5 @@ 10000 300m 1248 2288 46176 -3 2288 25000 300m 1248 2288 79040 -3 2288 40000 300m 1248 2288 108160 -3 2288 - 50000 300m 1248 2288 131456 -3 2288 + 50000 300m 1248 2288 141856 -3 2288 100000 300m 1248 2288 268736 -3 2288 diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/installer.conf b/device/dell/x86_64-dell_s6100_c2538-r0/installer.conf index 5efc436529e1..0a9a3a639eb2 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/installer.conf +++ b/device/dell/x86_64-dell_s6100_c2538-r0/installer.conf @@ -1,3 +1,3 @@ CONSOLE_PORT=0x2f8 CONSOLE_DEV=1 -ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="module_blacklist=gpio_ich,i2c_mux_gpio" +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="module_blacklist=gpio_ich" diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-C32/buffers_defaults_t1.j2 b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-C32/buffers_defaults_t1.j2 index 5c654ab9e8a1..e127362c091a 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-C32/buffers_defaults_t1.j2 +++ b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-C32/buffers_defaults_t1.j2 @@ -11,13 +11,13 @@ {%- macro generate_buffer_pool_and_profiles() %} "BUFFER_POOL": { "ingress_lossless_pool": { - "size": "10443264", + "size": "10875072", "type": "ingress", "mode": "dynamic", - "xoff": "4625920" + "xoff": "4194112" }, "egress_lossy_pool": { - "size": "8877440", + "size": "9243812", "type": "egress", "mode": "dynamic" }, diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-C8D48/buffers_defaults_t0.j2 b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-C8D48/buffers_defaults_t0.j2 index 4bd35b354c8a..f200b85b2027 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-C8D48/buffers_defaults_t0.j2 +++ b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-C8D48/buffers_defaults_t0.j2 @@ -25,13 +25,13 @@ {%- macro generate_buffer_pool_and_profiles() %} "BUFFER_POOL": { "ingress_lossless_pool": { - "size": "11213696", + "size": "10875072", "type": "ingress", "mode": "dynamic", - "xoff": "3855488" + "xoff": "4194112" }, "egress_lossy_pool": { - "size": "9532224", + "size": "9243812", "type": "egress", "mode": "dynamic" }, diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/installer.conf b/device/dell/x86_64-dell_z9100_c2538-r0/installer.conf index 5efc436529e1..0a9a3a639eb2 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/installer.conf +++ b/device/dell/x86_64-dell_z9100_c2538-r0/installer.conf @@ -1,3 +1,3 @@ CONSOLE_PORT=0x2f8 CONSOLE_DEV=1 -ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="module_blacklist=gpio_ich,i2c_mux_gpio" +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="module_blacklist=gpio_ich" diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/sai.profile b/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/sai.profile index 32994eb9a823..c13ca373750d 100644 --- a/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/sai.profile +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/usr/share/sai_2010.xml +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_2010.xml diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/sai_2010.xml b/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/sai_2010.xml index 8f4af640ddde..34151a434a23 100644 --- a/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/sai_2010.xml +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/sai_2010.xml @@ -5,15 +5,18 @@ 00:02:03:04:05:00 + + 1 + - 32 + 22 1 - 32 1 + 14 0 @@ -23,220 +26,150 @@ 2 - 33 1 + 15 0 939524096 3 - 34 1 + 16 0 939524096 4 - 35 1 + 17 0 939524096 5 - 36 - 1 - 0 - 4096 - - - 6 - 37 - 1 - 0 - 4096 - - - 7 - 38 - 1 - 0 - 4096 - - - 8 - 39 - 1 - 0 - 4096 + 4 + 19 + 3 + 11534336 9 - 40 - 1 - 0 - 4096 - - - 10 - 41 - 1 - 0 - 4096 - - - 11 - 42 - 1 - 0 - 4096 - - - 12 - 43 - 1 - 0 - 4096 + 4 + 18 + 3 + 11534336 13 - 44 - 1 - 0 - 4096 - - - 14 - 45 - 1 - 0 - 4096 - - - 15 - 46 - 1 - 0 - 4096 - - - 16 - 47 - 1 - 0 - 4096 + 4 + 21 + 3 + 11534336 17 - 48 - 1 - 0 - 4096 + 4 + 20 + 3 + 11534336 - 18 - 49 + 33 1 + 10 0 - 4096 + 939524096 - 19 + 34 1 - 3 + 11 0 - 4096 + 939524096 - 20 + 35 1 - 4 + 12 0 - 4096 + 939524096 - 21 + 36 1 - 5 + 13 0 - 4096 + 939524096 - 22 + 37 1 6 0 - 4096 + 939524096 - 23 + 38 1 7 0 - 4096 + 939524096 - 24 + 39 1 8 0 - 4096 + 939524096 - 25 + 40 1 9 0 - 4096 - - - 26 - 1 - 10 - 0 - 4096 + 939524096 - 27 + 41 1 - 11 + 2 0 - 4096 + 939524096 - 28 + 42 1 - 12 + 3 0 - 4096 + 939524096 - 29 + 43 1 - 13 + 4 0 - 4096 + 939524096 - 30 + 44 1 - 14 + 5 0 - 4096 + 939524096 - 31 + 45 1 - 15 + 0 0 - 4096 + 939524096 - 32 + 46 1 - 16 + 1 0 - 4096 + 939524096 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers.json.j2 new file mode 120000 index 000000000000..30c4e1d5bfdd --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers.json.j2 @@ -0,0 +1 @@ +../ACS-MSN2700/buffers.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers_defaults_t0.j2 new file mode 120000 index 000000000000..a722094938f8 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers_defaults_t0.j2 @@ -0,0 +1 @@ +../ACS-MSN2700/buffers_defaults_t0.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers_defaults_t1.j2 new file mode 120000 index 000000000000..b02d5e0194ac --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers_defaults_t1.j2 @@ -0,0 +1 @@ +../ACS-MSN2700/buffers_defaults_t1.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/pg_profile_lookup.ini new file mode 120000 index 000000000000..229a556f88a8 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/pg_profile_lookup.ini @@ -0,0 +1 @@ +../ACS-MSN2700/pg_profile_lookup.ini \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/port_config.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/port_config.ini new file mode 100644 index 000000000000..345e6a206731 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/port_config.ini @@ -0,0 +1,37 @@ +# name lanes speed alias index +Ethernet0 0,1,2,3 100000 etp1 1 +Ethernet4 4,5,6,7 100000 etp2 2 +Ethernet8 8,9,10,11 100000 etp3 3 +Ethernet12 12,13,14,15 100000 etp4 4 +Ethernet16 16,17,18,19 100000 etp5 5 +Ethernet20 20,21,22,23 100000 etp6 6 +Ethernet24 24,25,26,27 100000 etp7 7 +Ethernet28 28,29,30,31 100000 etp8 8 +Ethernet32 32,33,34,35 100000 etp9 9 +Ethernet36 36,37,38,39 100000 etp10 10 +Ethernet40 40,41,42,43 100000 etp11 11 +Ethernet44 44,45,46,47 100000 etp12 12 +Ethernet48 48,49,50,51 100000 etp13 13 +Ethernet52 52,53,54,55 100000 etp14 14 +Ethernet56 56,57,58,59 100000 etp15 15 +Ethernet60 60,61,62,63 100000 etp16 16 +Ethernet64 64,65,66,67 100000 etp17 17 +Ethernet68 68,69,70,71 100000 etp18 18 +Ethernet72 72,73,74,75 100000 etp19 19 +Ethernet76 76,77,78,79 100000 etp20 20 +Ethernet80 80,81,82,83 100000 etp21 21 +Ethernet84 84,85,86,87 100000 etp22 22 +Ethernet88 88,89,90,91 100000 etp23 23 +Ethernet92 92,93,94,95 100000 etp24 24 +Ethernet96 96,97,98,99 100000 etp25 25 +Ethernet100 100,101,102,103 100000 etp26 26 +Ethernet104 104,105,106,107 100000 etp27 27 +Ethernet108 108,109,110,111 100000 etp28 28 +Ethernet112 112,113 50000 etp29a 29 +Ethernet114 114,115 50000 etp29b 29 +Ethernet116 116,117 50000 etp30a 30 +Ethernet118 118,119 50000 etp30b 30 +Ethernet120 120,121 50000 etp31a 31 +Ethernet122 122,123 50000 etp31b 31 +Ethernet124 124,125 50000 etp32a 32 +Ethernet126 126,127 50000 etp32b 32 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/qos.json.j2 new file mode 120000 index 000000000000..8bd2d26567b8 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/qos.json.j2 @@ -0,0 +1 @@ +../ACS-MSN2700/qos.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/sai.profile b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/sai.profile new file mode 100644 index 000000000000..cfeb4a5fa4ba --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_2700_8x50g_28x100g.xml diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/sai_2700_8x50g_28x100g.xml b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/sai_2700_8x50g_28x100g.xml new file mode 100644 index 000000000000..ee20db3e5dde --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/sai_2700_8x50g_28x100g.xml @@ -0,0 +1,250 @@ + + + + + + 00:02:03:04:05:00 + + + 1 + + + 32 + + + + + 1 + 4 + 16 + + + 3 + + + 11534336 + + + 3 + 4 + 17 + 1 + 11534336 + + + 5 + 4 + 18 + 3 + 11534336 + + + 7 + 4 + 19 + 1 + 11534336 + + + 9 + 4 + 20 + 3 + 11534336 + + + 11 + 4 + 21 + 1 + 11534336 + + + 13 + 4 + 22 + 3 + 11534336 + + + 15 + 4 + 23 + 1 + 11534336 + + + 17 + 4 + 24 + 3 + 11534336 + + + 19 + 4 + 25 + 1 + 11534336 + + + 21 + 4 + 26 + 3 + 11534336 + + + 23 + 4 + 27 + 1 + 11534336 + + + 25 + 4 + 28 + 3 + 3221225472 + 2 + + + 27 + 4 + 29 + 1 + 3221225472 + 2 + + + 29 + 4 + 30 + 3 + 3221225472 + 2 + + + 31 + 4 + 31 + 1 + 3221225472 + 2 + + + 33 + 4 + 14 + 3 + 11534336 + + + 35 + 4 + 15 + 1 + 11534336 + + + 37 + 4 + 12 + 3 + 11534336 + + + 39 + 4 + 13 + 1 + 11534336 + + + 41 + 4 + 10 + 3 + 11534336 + + + 43 + 4 + 11 + 1 + 11534336 + + + 45 + 4 + 8 + 3 + 11534336 + + + 47 + 4 + 9 + 1 + 11534336 + + + 49 + 4 + 6 + 3 + 11534336 + + + 51 + 4 + 7 + 1 + 11534336 + + + 53 + 4 + 4 + 3 + 11534336 + + + 55 + 4 + 5 + 1 + 11534336 + + + 57 + 4 + 2 + 3 + 11534336 + + + 59 + 4 + 3 + 1 + 11534336 + + + 61 + 4 + 0 + 3 + 11534336 + + + 63 + 4 + 1 + 1 + 11534336 + + + + diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfplpmset.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfplpmset.py index 9713873ed264..c11675766d3f 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfplpmset.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfplpmset.py @@ -18,7 +18,15 @@ PMAOS_ENABLE = 1 PMAOS_DISABLE = 2 -def get_port_admin_status_by_log_port(log_port): +PORT_TYPE_NVE = 8 +PORT_TYPE_OFFSET = 28 +PORT_TYPE_MASK = 0xF0000000 +NVE_MASK = PORT_TYPE_MASK & (PORT_TYPE_NVE << PORT_TYPE_OFFSET) + +def is_nve(port): + return (port & NVE_MASK) != 0 + +def is_port_admin_status_up(log_port): oper_state_p = new_sx_port_oper_state_t_p() admin_state_p = new_sx_port_admin_state_t_p() module_state_p = new_sx_port_module_state_t_p() @@ -48,9 +56,10 @@ def get_log_ports(handle, sfp_module): log_port_list = [] for i in range(0, port_cnt): port_attributes = sx_port_attributes_t_arr_getitem(port_attributes_list, i) - if port_attributes.port_mapping.module_port == sfp_module: - if get_port_admin_status_by_log_port(port_attributes.log_port): - log_port_list.append(port_attributes.log_port) + if is_nve(int(port_attributes.log_port)) == False \ + and port_attributes.port_mapping.module_port == sfp_module \ + and is_port_admin_status_up(port_attributes.log_port): + log_port_list.append(port_attributes.log_port) return log_port_list diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py index e4f9f05d41ff..531e06f13205 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py @@ -22,7 +22,7 @@ # magic code defnition for port number, qsfp port position of each hwsku # port_position_tuple = (PORT_START, QSFP_PORT_START, PORT_END, PORT_IN_BLOCK, EEPROM_OFFSET) -hwsku_dict = {'ACS-MSN2700': 0, "LS-SN2700":0, 'ACS-MSN2740': 0, 'ACS-MSN2100': 1, 'ACS-MSN2410': 2, 'ACS-MSN2010': 3, } +hwsku_dict = {'ACS-MSN2700': 0, "LS-SN2700":0, 'ACS-MSN2740': 0, 'ACS-MSN2100': 1, 'ACS-MSN2410': 2, 'ACS-MSN2010': 3, 'ACS-MSN3700': 0, 'ACS-MSN3700C': 0, 'Mellanox-SN2700': 0, 'Mellanox-SN2700-D48C8': 0} port_position_tuple_list = [(0, 0, 31, 32, 1), (0, 0, 15, 16, 1), (0, 48, 55, 56, 1),(0, 18, 21, 22, 1)] class SfpUtil(SfpUtilBase): diff --git a/dockers/docker-base/Dockerfile.j2 b/dockers/docker-base/Dockerfile.j2 index 2aef59241b13..c622e6a59843 100644 --- a/dockers/docker-base/Dockerfile.j2 +++ b/dockers/docker-base/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM debian:jessie +## Remove retired jessie-updates repo +RUN sed -i '/deb http:\/\/deb.debian.org\/debian jessie-updates main/d' /etc/apt/sources.list + # Clean documentation in FROM image RUN find /usr/share/doc -depth \( -type f -o -type l \) ! -name copyright | xargs rm || true @@ -28,12 +31,9 @@ RUN apt-get -y install \ vim-tiny \ perl \ python \ + rsyslog \ less -# Install a newer version of rsyslog from jessie-backports in hopes of -# eliminating memory leaks -RUN apt-get -y -t jessie-backports install rsyslog - COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"] COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"] COPY ["root/.vimrc", "/root/.vimrc"] diff --git a/dockers/docker-base/etc/rsyslog.conf b/dockers/docker-base/etc/rsyslog.conf index cf5509a3e8b3..1af66c6e61c0 100644 --- a/dockers/docker-base/etc/rsyslog.conf +++ b/dockers/docker-base/etc/rsyslog.conf @@ -14,6 +14,13 @@ ################# $ModLoad imuxsock # provides support for local system logging + +# +# Set a rate limit on messages from the container +# +$SystemLogRateLimitInterval 300 +$SystemLogRateLimitBurst 20000 + #$ModLoad imklog # provides kernel logging support #$ModLoad immark # provides --MARK-- message capability diff --git a/dockers/docker-base/etc/rsyslog.d/supervisor.conf b/dockers/docker-base/etc/rsyslog.d/supervisor.conf index e6fece313efc..7c7a64d7afe0 100644 --- a/dockers/docker-base/etc/rsyslog.d/supervisor.conf +++ b/dockers/docker-base/etc/rsyslog.d/supervisor.conf @@ -5,4 +5,5 @@ $InputFileTag supervisord $InputFileStateFile state-supervisor $InputFileSeverity info $InputFileFacility local0 +$InputFilePersistStateInterval 1 $InputRunFileMonitor diff --git a/dockers/docker-base/sources.list b/dockers/docker-base/sources.list index 7121d6fd8c2d..2ed195cff416 100644 --- a/dockers/docker-base/sources.list +++ b/dockers/docker-base/sources.list @@ -5,4 +5,3 @@ deb http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-fre deb-src http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-free deb http://debian-archive.trafficmanager.net/debian-security/ jessie/updates main contrib non-free deb-src http://debian-archive.trafficmanager.net/debian-security/ jessie/updates main contrib non-free -deb http://debian-archive.trafficmanager.net/debian/ jessie-backports main contrib non-free diff --git a/dockers/docker-database/Dockerfile.j2 b/dockers/docker-database/Dockerfile.j2 index e24d528a980e..697b4309fe7d 100644 --- a/dockers/docker-database/Dockerfile.j2 +++ b/dockers/docker-database/Dockerfile.j2 @@ -1,7 +1,7 @@ FROM docker-config-engine ARG docker_container_name -RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#syslogtag%/;" /etc/rsyslog.conf +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf # Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-lldp-sv2/lldpd.conf.j2 b/dockers/docker-lldp-sv2/lldpd.conf.j2 index 94a04596699f..d5b6dba8700c 100644 --- a/dockers/docker-lldp-sv2/lldpd.conf.j2 +++ b/dockers/docker-lldp-sv2/lldpd.conf.j2 @@ -1,3 +1,12 @@ {% if MGMT_INTERFACE %} -configure ports eth0 lldp portidsubtype local {{ MGMT_INTERFACE.keys()[0][0] }} +{# If MGMT port alias is available, use it for port ID subtype, otherwise use port name #} +{% set mgmt_port_name = MGMT_INTERFACE.keys()[0][0] %} +{% set ipv4 = MGMT_INTERFACE.keys()[0][1].split('/')[0] %} +{% if MGMT_PORT and MGMT_PORT[mgmt_port_name] and MGMT_PORT[mgmt_port_name].alias %} +configure ports eth0 lldp portidsubtype local {{ MGMT_PORT[mgmt_port_name].alias }} +{% else %} +configure ports eth0 lldp portidsubtype local {{ mgmt_port_name }} {% endif %} +configure system ip management pattern {{ ipv4 }} +{% endif %} +configure system hostname {{ DEVICE_METADATA['localhost']['hostname'] }} diff --git a/dockers/docker-lldp-sv2/lldpmgrd b/dockers/docker-lldp-sv2/lldpmgrd index a044d5ed9d77..7d2528a9d3a6 100755 --- a/dockers/docker-lldp-sv2/lldpmgrd +++ b/dockers/docker-lldp-sv2/lldpmgrd @@ -73,17 +73,12 @@ def signal_handler(sig, frame): # ========================== Helpers ================================== -def is_port_up(port_name): - filename = "/sys/class/net/%s/operstate" % port_name +def is_port_exist(port_name): + filename = "/sys/class/net/%s/ifindex" % port_name if not os.path.exists(filename): return False - with open(filename) as fp: - state = fp.read() - if 'up' in state: - return True - else: - return False + return True # ============================== Classes ============================== @@ -119,9 +114,8 @@ class LldpManager(object): def generate_pending_lldp_config_cmd_for_port(self, port_name): """ - For port `port_name`, look up the neighboring device's hostname and - corresponding port alias in the Config database, then form the - appropriate lldpcli configuration command and run it. + For port `port_name`, look up the description and alias in the Config database, + then form the appropriate lldpcli configuration command and run it. """ # Retrieve all entires for this port from the Port table port_table = swsscommon.Table(self.config_db, swsscommon.CFG_PORT_TABLE_NAME) @@ -135,34 +129,21 @@ class LldpManager(object): if not port_alias: log_info("Unable to retrieve port alias for port '{}'. Using port name instead.".format(port_name)) port_alias = port_name + + # Get the port description. If None or empty string, we'll skip this configuration + port_desc = port_table_dict.get("description") + else: log_error("Port '{}' not found in {} table in Config DB. Using port name instead of port alias.".format(port_name, swsscommon.CFG_PORT_TABLE_NAME)) port_alias = port_name lldpcli_cmd = "lldpcli configure ports {0} lldp portidsubtype local {1}".format(port_name, port_alias) - # Retrieve all entires for this port from the Device Neighbor table - device_neighbor_table = swsscommon.Table(self.config_db, swsscommon.CFG_DEVICE_NEIGHBOR_TABLE_NAME) - (status, fvp) = device_neighbor_table.get(port_name) - if status: - # Convert list of tuples to a dictionary - device_neighbor_table_dict = dict(fvp) - - # Get neighbor host name and port name - neighbor_hostname = device_neighbor_table_dict.get("name") - neighbor_portname = device_neighbor_table_dict.get("port") - - # If we sucessfully obtained the neighbor's host name and port name, append a port description to the command - if neighbor_hostname and neighbor_portname: - lldpcli_cmd += " description {0}:{1}".format(neighbor_hostname, neighbor_portname) - else: - if not neighbor_hostname: - log_info("Failed to retrieve neighbor host name for port '{}'. Not adding port description.".format(port_name)) - - if not neighbor_portname: - log_info("Failed to retrieve neighbor port name for port '{}'. Not adding port description.".format(port_name)) + # if there is a description available, also configure that + if port_desc: + lldpcli_cmd += " description {}".format(port_desc) else: - log_info("Unable to retrieve neighbor information for port '{}'. Not adding port description.".format(port_name)) + log_info("Unable to retrieve description for port '{}'. Not adding port description".format(port_name)) # Add the command to our dictionary of pending commands, overwriting any # previous pending command for this port @@ -173,8 +154,8 @@ class LldpManager(object): to_delete = [] for (port_name, cmd) in self.pending_cmds.iteritems(): - if not is_port_up(port_name): - # it doesn't make any sense to configure lldpd if the target port is unavailable + if not is_port_exist(port_name): + # it doesn't make any sense to configure lldpd if the target port does not exist # let's postpone the command for the next iteration continue @@ -200,9 +181,11 @@ class LldpManager(object): def run(self): """ - Infinite loop. Subscribes to notifications of changes in the PORT table - of the Redis State database. When we are notified of the creation of an - interface, update LLDP configuration accordingly. + Subscribes to notifications of changes in the PORT table + of the Redis State database. + Subscribe to STATE_DB - get notified of the creation of an interface + Subscribe to CONFIG_DB - get notified of port config changes + Update LLDP configuration accordingly. """ # Set select timeout to 10 seconds SELECT_TIMEOUT_MS = 1000 * 10 @@ -211,8 +194,10 @@ class LldpManager(object): sel = swsscommon.Select() sst = swsscommon.SubscriberStateTable(self.state_db, swsscommon.STATE_PORT_TABLE_NAME) sel.addSelectable(sst) + sst = swsscommon.SubscriberStateTable(self.config_db, swsscommon.CFG_PORT_TABLE_NAME) + sel.addSelectable(sst) - # Listen indefinitely for changes to the PORT table in the State DB + # Listen for changes to the PORT table in the STATE_DB and CONFIG_DB while True: (state, c) = sel.select(SELECT_TIMEOUT_MS) @@ -221,9 +206,14 @@ class LldpManager(object): fvp_dict = dict(fvp) + # handle creation if op == "SET" and fvp_dict.get("state") == "ok": self.generate_pending_lldp_config_cmd_for_port(key) + # handle config change + if op in ["SET", "DEL"] and (fvp_dict.get("alias") or fvp_dict.get("description")) : + self.generate_pending_lldp_config_cmd_for_port(key) + # Process all pending commands self.process_pending_cmds() diff --git a/dockers/docker-lldp-sv2/start.sh b/dockers/docker-lldp-sv2/start.sh index adc322979813..76666e77aca2 100755 --- a/dockers/docker-lldp-sv2/start.sh +++ b/dockers/docker-lldp-sv2/start.sh @@ -10,8 +10,6 @@ rm -f /var/run/lldpd.socket supervisorctl start rsyslogd supervisorctl start lldpd -supervisorctl start lldp-syncd -supervisorctl start lldpmgrd # Current lldpd version has a bug. # When lldpd starts it is in the pause state by default @@ -35,3 +33,6 @@ do lldpcli -u /var/run/lldpd.socket -c /etc/lldpd.conf -c /etc/lldpd.d resume > /dev/null && break sleep 1 done + +supervisorctl start lldp-syncd +supervisorctl start lldpmgrd diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index d9e9bcad0b91..4b4b6731a6ed 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -29,6 +29,8 @@ supervisorctl start neighsyncd supervisorctl start swssconfig +supervisorctl start vrfmgrd + supervisorctl start vlanmgrd supervisorctl start intfmgrd @@ -39,8 +41,6 @@ supervisorctl start buffermgrd supervisorctl start enable_counters -supervisorctl start vrfmgrd - supervisorctl start nbrmgrd # Start arp_update when VLAN exists diff --git a/dockers/docker-orchagent/supervisord.conf b/dockers/docker-orchagent/supervisord.conf index 2fe25a7a4106..e6bfba3cb283 100644 --- a/dockers/docker-orchagent/supervisord.conf +++ b/dockers/docker-orchagent/supervisord.conf @@ -35,17 +35,9 @@ autorestart=false stdout_logfile=syslog stderr_logfile=syslog -[program:intfsyncd] -command=/usr/bin/intfsyncd -priority=5 -autostart=false -autorestart=false -stdout_logfile=syslog -stderr_logfile=syslog - [program:neighsyncd] command=/usr/bin/neighsyncd -priority=6 +priority=5 autostart=false autorestart=false stdout_logfile=syslog @@ -53,7 +45,7 @@ stderr_logfile=syslog [program:swssconfig] command=/usr/bin/swssconfig.sh -priority=7 +priority=6 autostart=false autorestart=unexpected startretries=0 @@ -63,7 +55,7 @@ stderr_logfile=syslog [program:arp_update] command=/usr/bin/arp_update -priority=8 +priority=7 autostart=false autorestart=unexpected stdout_logfile=syslog @@ -71,7 +63,7 @@ stderr_logfile=syslog [program:vlanmgrd] command=/usr/bin/vlanmgrd -priority=9 +priority=8 autostart=false autorestart=false stdout_logfile=syslog @@ -79,7 +71,7 @@ stderr_logfile=syslog [program:intfmgrd] command=/usr/bin/intfmgrd -priority=10 +priority=9 autostart=false autorestart=false stdout_logfile=syslog @@ -87,7 +79,7 @@ stderr_logfile=syslog [program:portmgrd] command=/usr/bin/portmgrd -priority=11 +priority=10 autostart=false autorestart=false stdout_logfile=syslog @@ -95,7 +87,7 @@ stderr_logfile=syslog [program:buffermgrd] command=/usr/bin/buffermgrd -l /usr/share/sonic/hwsku/pg_profile_lookup.ini -priority=12 +priority=11 autostart=false autorestart=false stdout_logfile=syslog @@ -103,7 +95,7 @@ stderr_logfile=syslog [program:enable_counters] command=/usr/bin/enable_counters.py -priority=13 +priority=12 autostart=false autorestart=false stdout_logfile=syslog @@ -111,7 +103,7 @@ stderr_logfile=syslog [program:vrfmgrd] command=/usr/bin/vrfmgrd -priority=14 +priority=13 autostart=false autorestart=false stdout_logfile=syslog @@ -119,7 +111,7 @@ stderr_logfile=syslog [program:restore_neighbors] command=/usr/bin/restore_neighbors.py -priority=15 +priority=14 autostart=false autorestart=false startsecs=0 @@ -129,7 +121,7 @@ stderr_logfile=syslog [program:nbrmgrd] command=/usr/bin/nbrmgrd -priority=16 +priority=15 autostart=false autorestart=false stdout_logfile=syslog diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index c6915f0597a1..c521fadf0a49 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -43,8 +43,8 @@ HWSKU=`sonic-cfggen -d -v "DEVICE_METADATA['localhost']['hwsku']"` # Don't load json config if system warm start or # swss docker warm start is enabled, the data already exists in appDB. -SYSTEM_WARM_START=`redis-cli -n 4 hget "WARM_RESTART|system" enable` -SWSS_WARM_START=`redis-cli -n 4 hget "WARM_RESTART|swss" enable` +SYSTEM_WARM_START=`redis-cli -n 6 hget "WARM_RESTART_ENABLE_TABLE|system" enable` +SWSS_WARM_START=`redis-cli -n 6 hget "WARM_RESTART_ENABLE_TABLE|swss" enable` if [[ "$SYSTEM_WARM_START" == "true" ]] || [[ "$SWSS_WARM_START" == "true" ]]; then # We have to make sure db data has not been flushed. RESTORE_COUNT=`redis-cli -n 6 hget "WARM_RESTART_TABLE|orchagent" restore_count` diff --git a/dockers/docker-ptf/Dockerfile.j2 b/dockers/docker-ptf/Dockerfile.j2 index 2d9b1544d95a..7512627e9923 100644 --- a/dockers/docker-ptf/Dockerfile.j2 +++ b/dockers/docker-ptf/Dockerfile.j2 @@ -2,6 +2,9 @@ FROM debian:jessie MAINTAINER Pavel Shirshov +## Remove retired jessie-updates repo +RUN sed -i '/deb http:\/\/deb.debian.org\/debian jessie-updates main/d' /etc/apt/sources.list + ## Copy dependencies COPY \ {% for deb in docker_ptf_debs.split(' ') -%} diff --git a/dockers/docker-router-advertiser/Dockerfile.j2 b/dockers/docker-router-advertiser/Dockerfile.j2 index 1385e1ebec63..9e56515fc1e6 100644 --- a/dockers/docker-router-advertiser/Dockerfile.j2 +++ b/dockers/docker-router-advertiser/Dockerfile.j2 @@ -30,6 +30,6 @@ RUN rm -rf /debs COPY ["start.sh", "/usr/bin/"] COPY ["docker-router-advertiser.supervisord.conf", "/etc/supervisor/conf.d/"] -COPY ["radvd.conf.j2", "/usr/share/sonic/templates/"] +COPY ["radvd.conf.j2", "wait_for_intf.sh.j2", "/usr/share/sonic/templates/"] ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/docker-router-advertiser/start.sh b/dockers/docker-router-advertiser/start.sh index 159006a176bd..8d5f73a8bcb0 100755 --- a/dockers/docker-router-advertiser/start.sh +++ b/dockers/docker-router-advertiser/start.sh @@ -21,5 +21,12 @@ if [ $NUM_IFACES -eq 0 ]; then exit 0 fi +# Generate the script that waits for pertinent interfaces to come up and make it executable +sonic-cfggen -d -t /usr/share/sonic/templates/wait_for_intf.sh.j2 > /usr/bin/wait_for_intf.sh +chmod +x /usr/bin/wait_for_intf.sh + +# Wait for pertinent interfaces to come up +/usr/bin/wait_for_intf.sh + # Start the router advertiser supervisorctl start radvd diff --git a/dockers/docker-router-advertiser/wait_for_intf.sh.j2 b/dockers/docker-router-advertiser/wait_for_intf.sh.j2 new file mode 100644 index 000000000000..856c47678f23 --- /dev/null +++ b/dockers/docker-router-advertiser/wait_for_intf.sh.j2 @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +STATE_DB_IDX="6" + +VLAN_TABLE_PREFIX="VLAN_TABLE" + +function wait_until_iface_ready +{ + TABLE_PREFIX=$1 + IFACE=$2 + + echo "Waiting until interface $IFACE is ready..." + + # Wait for the interface to come up + # (i.e., interface is present in STATE_DB and state is "ok") + while true; do + RESULT=$(redis-cli -n ${STATE_DB_IDX} HGET "${TABLE_PREFIX}|${IFACE}" "state" 2> /dev/null) + if [ x"$RESULT" == x"ok" ]; then + break + fi + + sleep 1 + done + + echo "Interface ${IFACE} is ready!" +} + + +# Wait for all interfaces to be up and ready +{% for (name, prefix) in VLAN_INTERFACE %} +wait_until_iface_ready ${VLAN_TABLE_PREFIX} {{ name }} +{% endfor %} diff --git a/dockers/docker-snmp-sv2/Dockerfile.j2 b/dockers/docker-snmp-sv2/Dockerfile.j2 index f8deee49d37c..ec50a4c8c2a2 100644 --- a/dockers/docker-snmp-sv2/Dockerfile.j2 +++ b/dockers/docker-snmp-sv2/Dockerfile.j2 @@ -35,6 +35,9 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return RUN curl https://bootstrap.pypa.io/get-pip.py | python3.6 RUN python3.6 -m pip install --no-cache-dir hiredis +# Install pyyaml dependency for use by some plugins +RUN python3.6 -m pip install --no-cache-dir pyyaml + {% if docker_snmp_sv2_whls.strip() -%} # Copy locally-built Python wheel dependencies {%- for whl in docker_snmp_sv2_whls.split(' ') %} diff --git a/files/build_templates/bgp.service.j2 b/files/build_templates/bgp.service.j2 index bc023b7d714d..7200a0e3ecf2 100644 --- a/files/build_templates/bgp.service.j2 +++ b/files/build_templates/bgp.service.j2 @@ -7,7 +7,7 @@ Before=ntp-config.service [Service] User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{docker_container_name}}.sh start -ExecStart=/usr/bin/{{docker_container_name}}.sh attach +ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] diff --git a/files/build_templates/buffers_config.j2 b/files/build_templates/buffers_config.j2 index 7c9b22de1954..2db9372340c4 100644 --- a/files/build_templates/buffers_config.j2 +++ b/files/build_templates/buffers_config.j2 @@ -29,18 +29,22 @@ def {# 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' - } --%} +{%- if defs.ports2cable is defined %} + {%- set ports2cable = defs.ports2cable %} +{%- else %} + {%- set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } + -%} +{%- endif %} {%- 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] %} + {%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} {%- set neighbor_role = neighbor.type %} {%- set roles1 = switch_role + '_' + neighbor_role %} @@ -127,10 +131,7 @@ def {{ defs.generate_pg_profils(port_names_active) }} {% else %} "BUFFER_PG": { - "{{ port_names_active }}|0-1": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "{{ port_names_active }}|5": { + "{{ port_names_active }}|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" } }, @@ -143,10 +144,10 @@ def "{{ port_names_active }}|3-4": { "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" }, - "{{ port_names_active }}|0-1": { + "{{ port_names_active }}|0-2": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" }, - "{{ port_names_active }}|5": { + "{{ port_names_active }}|5-6": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" } } diff --git a/files/build_templates/database.service.j2 b/files/build_templates/database.service.j2 index b248dfc7fecd..efa98b168beb 100644 --- a/files/build_templates/database.service.j2 +++ b/files/build_templates/database.service.j2 @@ -6,7 +6,7 @@ After=docker.service [Service] User=root ExecStartPre=/usr/bin/{{docker_container_name}}.sh start -ExecStart=/usr/bin/{{docker_container_name}}.sh attach +ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] diff --git a/files/build_templates/dhcp_relay.service.j2 b/files/build_templates/dhcp_relay.service.j2 index b4d9ceb38f0c..5a462e53973d 100644 --- a/files/build_templates/dhcp_relay.service.j2 +++ b/files/build_templates/dhcp_relay.service.j2 @@ -7,7 +7,7 @@ Before=ntp-config.service [Service] User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{ docker_container_name }}.sh start -ExecStart=/usr/bin/{{ docker_container_name }}.sh attach +ExecStart=/usr/bin/{{ docker_container_name }}.sh wait ExecStop=/usr/bin/{{ docker_container_name }}.sh stop [Install] diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index a3cbf5adbae7..92c3f69c8a8d 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -103,9 +103,17 @@ start() { DOCKERCHECK=`docker inspect --type container {{docker_container_name}} 2>/dev/null` if [ "$?" -eq "0" ]; then + {%- if docker_container_name == "database" %} + DOCKERMOUNT="" + {%- else %} DOCKERMOUNT=`getMountPoint "$DOCKERCHECK"` - if [ "$DOCKERMOUNT" == "$HWSKU" ]; then + {%- endif %} + if [ x"$DOCKERMOUNT" == x"$HWSKU" ]; then + {%- if docker_container_name == "database" %} + echo "Starting existing {{docker_container_name}} container" + {%- else %} echo "Starting existing {{docker_container_name}} container with HWSKU $HWSKU" + {%- endif %} preStartAction docker start {{docker_container_name}} postStartAction @@ -150,8 +158,8 @@ start() { postStartAction } -attach() { - docker attach --no-stdin {{docker_container_name}} +wait() { + docker wait {{docker_container_name}} } stop() { @@ -159,11 +167,11 @@ stop() { } case "$1" in - start|stop|attach) + start|wait|stop) $1 ;; *) - echo "Usage: $0 {start|stop|attach}" + echo "Usage: $0 {start|wait|stop}" exit 1 ;; esac diff --git a/files/build_templates/lldp.service.j2 b/files/build_templates/lldp.service.j2 index d294a08900f4..c317e18efc5c 100644 --- a/files/build_templates/lldp.service.j2 +++ b/files/build_templates/lldp.service.j2 @@ -7,7 +7,7 @@ Before=ntp-config.service [Service] User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{docker_container_name}}.sh start -ExecStart=/usr/bin/{{docker_container_name}}.sh attach +ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] diff --git a/files/build_templates/pmon.service.j2 b/files/build_templates/pmon.service.j2 index de4e62df5e10..33f3173b4887 100644 --- a/files/build_templates/pmon.service.j2 +++ b/files/build_templates/pmon.service.j2 @@ -7,7 +7,7 @@ Before=ntp-config.service [Service] User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{docker_container_name}}.sh start -ExecStart=/usr/bin/{{docker_container_name}}.sh attach +ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] diff --git a/files/build_templates/qos_config.j2 b/files/build_templates/qos_config.j2 index a76a64e3fb35..a666367873bd 100644 --- a/files/build_templates/qos_config.j2 +++ b/files/build_templates/qos_config.j2 @@ -38,12 +38,12 @@ "TC_TO_PRIORITY_GROUP_MAP": { "AZURE": { "0": "0", - "1": "1", - "2": "2", + "1": "0", + "2": "0", "3": "3", "4": "4", - "5": "5", - "6": "6", + "5": "0", + "6": "0", "7": "7" } }, @@ -74,76 +74,80 @@ }, "DSCP_TO_TC_MAP": { "AZURE": { - "0" : "0", - "1" : "0", - "2" : "0", + "0" : "1", + "1" : "1", + "2" : "1", "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", + "5" : "2", + "6" : "1", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "1", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", "46": "5", - "47": "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" + "47": "1", + "48": "6", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" } }, "SCHEDULER": { "scheduler.0": { "type" : "DWRR", - "weight": "20" + "weight": "14" + }, + "scheduler.1": { + "type" : "DWRR", + "weight": "15" } }, {% if asic_type in pfc_to_pg_map_supported_asics %} @@ -186,13 +190,13 @@ "QUEUE": { {% for port in PORT_ACTIVE %} "{{ port }}|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, {% endfor %} {% for port in PORT_ACTIVE %} "{{ port }}|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, {% endfor %} @@ -206,9 +210,19 @@ "scheduler": "[SCHEDULER|scheduler.0]" }, {% endfor %} +{% for port in PORT_ACTIVE %} + "{{ port }}|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, +{% endfor %} {% for port in PORT_ACTIVE %} "{{ port }}|5": { "scheduler": "[SCHEDULER|scheduler.0]" + }, +{% endfor %} +{% for port in PORT_ACTIVE %} + "{{ port }}|6": { + "scheduler": "[SCHEDULER|scheduler.0]" }{% if not loop.last %},{% endif %} {% endfor %} diff --git a/files/build_templates/radv.service.j2 b/files/build_templates/radv.service.j2 index 065f01906076..8cda2fdd0afb 100644 --- a/files/build_templates/radv.service.j2 +++ b/files/build_templates/radv.service.j2 @@ -7,7 +7,7 @@ Before=ntp-config.service [Service] User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{ docker_container_name }}.sh start -ExecStart=/usr/bin/{{ docker_container_name }}.sh attach +ExecStart=/usr/bin/{{ docker_container_name }}.sh wait ExecStop=/usr/bin/{{ docker_container_name }}.sh stop [Install] diff --git a/files/build_templates/snmp.service.j2 b/files/build_templates/snmp.service.j2 index f344f2e805ea..b00c2107702c 100644 --- a/files/build_templates/snmp.service.j2 +++ b/files/build_templates/snmp.service.j2 @@ -6,5 +6,5 @@ Before=ntp-config.service [Service] ExecStartPre=/usr/bin/{{docker_container_name}}.sh start -ExecStart=/usr/bin/{{docker_container_name}}.sh attach +ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index ed8df864cd06..0eeba7bad965 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -144,6 +144,11 @@ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable ntp-config.service sudo cp $IMAGE_CONFIGS/ntp/ntp-config.sh $FILESYSTEM_ROOT/usr/bin/ sudo cp $IMAGE_CONFIGS/ntp/ntp.conf.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/ +# Copy warmboot-finalizer files +sudo LANG=C cp $IMAGE_CONFIGS/warmboot-finalizer/finalize-warmboot.sh $FILESYSTEM_ROOT/usr/local/bin/finalize-warmboot.sh +sudo LANG=C cp $IMAGE_CONFIGS/warmboot-finalizer/warmboot-finalizer.service $FILESYSTEM_ROOT/etc/systemd/system/ +sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable warmboot-finalizer.service + # Copy rsyslog configuration files and templates sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog-config.service $FILESYSTEM_ROOT/etc/systemd/system/ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable rsyslog-config.service @@ -319,9 +324,9 @@ sudo cp {{src}} $FILESYSTEM_ROOT/{{dst}} {% if sonic_asic_platform == "mellanox" %} sudo mkdir -p $FILESYSTEM_ROOT/etc/mlnx/ sudo cp target/files/$MLNX_FW_FILE $FILESYSTEM_ROOT/etc/mlnx/fw-SPC.mfa +sudo cp target/files/$ISSU_VERSION_FILE $FILESYSTEM_ROOT/etc/mlnx/issu-version sudo cp target/files/$MLNX_FFB_SCRIPT $FILESYSTEM_ROOT/usr/bin/mlnx-ffb.sh j2 platform/mellanox/mlnx-fw-upgrade.j2 | sudo tee $FILESYSTEM_ROOT/usr/bin/mlnx-fw-upgrade.sh -j2 platform/mellanox/sdk-version.j2 | sudo tee $FILESYSTEM_ROOT/etc/mlnx/sdk-version sudo chmod 755 $FILESYSTEM_ROOT/usr/bin/mlnx-fw-upgrade.sh {% endif %} diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index 906bae7c11c2..abf57b7bc89f 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -13,7 +13,8 @@ Before=ntp-config.service [Service] User=root Environment=sonic_asic_platform={{ sonic_asic_platform }} -ExecStart=/usr/local/bin/swss.sh start +ExecStartPre=/usr/local/bin/swss.sh start +ExecStart=/usr/local/bin/swss.sh wait ExecStop=/usr/local/bin/swss.sh stop [Install] diff --git a/files/build_templates/syncd.service.j2 b/files/build_templates/syncd.service.j2 index 70759f7c6b0d..0c61b3193877 100644 --- a/files/build_templates/syncd.service.j2 +++ b/files/build_templates/syncd.service.j2 @@ -13,12 +13,14 @@ After=opennsl-modules-4.9.0-8-amd64.service {% elif sonic_asic_platform == 'nephos' %} After=nps-modules-4.9.0-8-amd64.service {% endif %} +After=swss.service Before=ntp-config.service [Service] User=root Environment=sonic_asic_platform={{ sonic_asic_platform }} -ExecStart=/usr/local/bin/syncd.sh start +ExecStartPre=/usr/local/bin/syncd.sh start +ExecStart=/usr/local/bin/syncd.sh wait ExecStop=/usr/local/bin/syncd.sh stop [Install] diff --git a/files/build_templates/teamd.service.j2 b/files/build_templates/teamd.service.j2 index 5cd36c6748b9..792b8247119f 100644 --- a/files/build_templates/teamd.service.j2 +++ b/files/build_templates/teamd.service.j2 @@ -7,7 +7,7 @@ Before=ntp-config.service [Service] User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{docker_container_name}}.sh start -ExecStart=/usr/bin/{{docker_container_name}}.sh attach +ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] diff --git a/files/build_templates/telemetry.service.j2 b/files/build_templates/telemetry.service.j2 index 132924b04193..d6f70a13206e 100644 --- a/files/build_templates/telemetry.service.j2 +++ b/files/build_templates/telemetry.service.j2 @@ -7,7 +7,7 @@ Before=ntp-config.service [Service] User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{docker_container_name}}.sh start -ExecStart=/usr/bin/{{docker_container_name}}.sh attach +ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] diff --git a/files/image_config/caclmgrd/caclmgrd b/files/image_config/caclmgrd/caclmgrd index a7ec952ca21f..5e8d83074de1 100755 --- a/files/image_config/caclmgrd/caclmgrd +++ b/files/image_config/caclmgrd/caclmgrd @@ -183,7 +183,15 @@ class ControlPlaneAclManager(object): for ((rule_table_name, rule_id), rule_props) in self._rules_db_info.iteritems(): if rule_table_name == table_name: - acl_rules[rule_props["PRIORITY"]] = rule_props + if not rule_props: + log_warning("rule_props for rule_id {} empty or null!".format(rule_id)) + continue + + try: + acl_rules[rule_props["PRIORITY"]] = rule_props + except KeyError: + log_error("rule_props for rule_id {} does not have key 'PRIORITY'!".format(rule_id)) + continue # If we haven't determined the IP version for this ACL table yet, # try to do it now. We determine heuristically based on whether the diff --git a/files/image_config/hostcfgd/hostcfgd b/files/image_config/hostcfgd/hostcfgd index f156f7e9402c..ae51af5cc8e4 100755 --- a/files/image_config/hostcfgd/hostcfgd +++ b/files/image_config/hostcfgd/hostcfgd @@ -44,8 +44,6 @@ class AaaCfg(object): def __init__(self): self.auth_default = { 'login': 'local', - 'failthrough': True, - 'fallback': True } self.tacplus_global_default = { 'auth_type': TACPLUS_SERVER_AUTH_TYPE_DEFAULT, @@ -159,14 +157,14 @@ class HostConfigDaemon: log_data = copy.deepcopy(data) if log_data.has_key('passkey'): log_data['passkey'] = obfuscate(log_data['passkey']) - syslog.syslog(syslog.LOG_DEBUG, 'value of {} changed to {}'.format(key, log_data)) + syslog.syslog(syslog.LOG_INFO, 'value of {} changed to {}'.format(key, log_data)) def tacacs_global_handler(self, key, data): self.aaacfg.tacacs_global_update(key, data) log_data = copy.deepcopy(data) if log_data.has_key('passkey'): log_data['passkey'] = obfuscate(log_data['passkey']) - syslog.syslog(syslog.LOG_DEBUG, 'value of {} changed to {}'.format(key, log_data)) + syslog.syslog(syslog.LOG_INFO, 'value of {} changed to {}'.format(key, log_data)) def start(self): self.config_db.subscribe('AAA', lambda table, key, data: self.aaa_handler(key, data)) diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index acac42e326e1..3596eb18419c 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -106,24 +106,31 @@ value_extract() { done } -# Set up previous and next reboot cause files +# Set up previous and next reboot cause files accordingly process_reboot_cause() { - REBOOT_CAUSE_FILE="/var/cache/sonic/reboot-cause.txt" - PREVIOUS_REBOOT_CAUSE_FILE="/var/cache/sonic/previous-reboot-cause.txt" - - # Set the previous reboot cause accordingly - # If this is the first boot after an image install, state that as the - # cause. Otherwise, move REBOOT_CAUSE_FILE to PREVIOUS_REBOOT_CAUSE_FILE. - # REBOOT_CAUSE_FILE should always exist, but we add the else case - # to ensure we always generate PREVIOUS_REBOOT_CAUSE_FILE here + REBOOT_CAUSE_DIR="/host/reboot-cause" + REBOOT_CAUSE_FILE="${REBOOT_CAUSE_DIR}/reboot-cause.txt" + PREVIOUS_REBOOT_CAUSE_FILE="${REBOOT_CAUSE_DIR}/previous-reboot-cause.txt" + + mkdir -p $REBOOT_CAUSE_DIR + + # If this is the first boot after an image install, store that as the + # previous reboot cause. if [ -f $FIRST_BOOT_FILE ]; then echo "SONiC image installation" > $PREVIOUS_REBOOT_CAUSE_FILE - elif [ -f $REBOOT_CAUSE_FILE ]; then + fi + + # If there is an existing REBOOT_CAUSE_FILE, copy that file to + # PREVIOUS_REBOOT_CAUSE_FILE. + if [ -f $REBOOT_CAUSE_FILE ]; then mv -f $REBOOT_CAUSE_FILE $PREVIOUS_REBOOT_CAUSE_FILE else echo "Unknown reboot cause" > $PREVIOUS_REBOOT_CAUSE_FILE fi + # Log the previous reboot cause to the syslog + logger "Previous reboot cause: $(cat $PREVIOUS_REBOOT_CAUSE_FILE)" + # Set the default cause for the next reboot echo "Unexpected reboot" > $REBOOT_CAUSE_FILE } diff --git a/files/image_config/updategraph/updategraph b/files/image_config/updategraph/updategraph index 63f788afc465..686108727b27 100755 --- a/files/image_config/updategraph/updategraph +++ b/files/image_config/updategraph/updategraph @@ -18,21 +18,21 @@ reload_minigraph() pfcwd start_default } -function copy_config_files() +function copy_config_files_and_directories() { - for file in $@; do - if [ -f /etc/sonic/old_config/${file} ]; then - logger "Copying SONiC configuration ${file} ..." - cp /etc/sonic/old_config/${file} /etc/sonic/ + for file_dir in $@; do + if [ -f /etc/sonic/old_config/${file_dir} ] || [ -d /etc/sonic/old_config/${file_dir} ]; then + logger "Copying SONiC configuration ${file_dir} ..." + cp -ar /etc/sonic/old_config/${file_dir} /etc/sonic/ else - logger "Missing SONiC configuration ${file} ..." + logger "Missing SONiC configuration ${file_dir} ..." fi done } function check_system_warm_boot() { - SYSTEM_WARM_START=`/usr/bin/redis-cli -n 4 hget "WARM_RESTART|system" enable` + SYSTEM_WARM_START=`/usr/bin/redis-cli -n 6 hget "WARM_RESTART_ENABLE_TABLE|system" enable` # SYSTEM_WARM_START could be empty, always make WARM_BOOT meaningful. if [[ x"$SYSTEM_WARM_START" == x"true" ]]; then WARM_BOOT="true" @@ -50,9 +50,9 @@ fi . /etc/sonic/updategraph.conf check_system_warm_boot - +copy_list="minigraph.xml snmp.yml acl.json config_db.json frr" if [ -f /tmp/pending_config_migration ]; then - copy_config_files minigraph.xml snmp.yml acl.json config_db.json + copy_config_files_and_directories $copy_list if [ x"${WARM_BOOT}" == x"true" ]; then echo "Warm reboot detected..." elif [ "$enabled" = "true" ]; then @@ -71,7 +71,7 @@ fi if [ -f /tmp/pending_config_initialization ]; then rm -f /tmp/pending_config_initialization - if [ "$enabled" != "true" ]; then + if [ "$enabled" != "true" ]; then PLATFORM=`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform` PRESET=(`head -n 1 /usr/share/sonic/device/$PLATFORM/default_sku`) sonic-cfggen -H -k ${PRESET[0]} --preset ${PRESET[1]} > /etc/sonic/config_db.json diff --git a/files/image_config/warmboot-finalizer/finalize-warmboot.sh b/files/image_config/warmboot-finalizer/finalize-warmboot.sh new file mode 100755 index 000000000000..653a00291f72 --- /dev/null +++ b/files/image_config/warmboot-finalizer/finalize-warmboot.sh @@ -0,0 +1,96 @@ +#! /bin/bash + +VERBOSE=no + +# Check components +COMP_LIST="orchagent neighsyncd bgp" +EXP_STATE="reconciled" + +ASSISTANT_SCRIPT="/usr/bin/neighbor_advertiser" + + +function debug() +{ + /usr/bin/logger "WARMBOOT_FINALIZER : $1" + if [[ x"${VERBOSE}" == x"yes" ]]; then + echo `date` "- $1" + fi +} + + +function check_warm_boot() +{ + WARM_BOOT=`/usr/bin/redis-cli -n 6 hget "WARM_RESTART_ENABLE_TABLE|system" enable` +} + + +function wait_for_database_service() +{ + debug "Wait for database to become ready..." + + # Wait for redis server start before database clean + until [[ $(/usr/bin/docker exec database redis-cli ping | grep -c PONG) -gt 0 ]]; + do sleep 1; + done + + # Wait for configDB initialization + until [[ $(/usr/bin/docker exec database redis-cli -n 4 GET "CONFIG_DB_INITIALIZED") ]]; + do sleep 1; + done + + debug "Database is ready..." +} + + +function get_component_state() +{ + /usr/bin/redis-cli -n 6 hget "WARM_RESTART_TABLE|$1" state +} + + +function check_list() +{ + RET_LIST='' + for comp in $@; do + state=`get_component_state ${comp}` + if [[ x"${state}" != x"${EXP_STATE}" ]]; then + RET_LIST="${RET_LIST} ${comp}" + fi + done + + echo ${RET_LIST} +} + + +function finalize_warm_boot() +{ + debug "Finalizing warmboot..." + sudo config warm_restart disable +} + + +wait_for_database_service + +check_warm_boot + +if [[ x"${WARM_BOOT}" != x"true" ]]; then + debug "warmboot is not enabled ..." + exit 0 +fi + +list=${COMP_LIST} + +# Wait up to 5 minutes +for i in `seq 60`; do + list=`check_list ${list}` + if [[ -z "${list}" ]]; then + break + fi + sleep 5 +done + +if [[ -n "${list}" ]]; then + debug "Some components didn't finish reconcile: ${list} ..." +fi + +finalize_warm_boot diff --git a/files/image_config/warmboot-finalizer/warmboot-finalizer.service b/files/image_config/warmboot-finalizer/warmboot-finalizer.service new file mode 100644 index 000000000000..72cc6e338982 --- /dev/null +++ b/files/image_config/warmboot-finalizer/warmboot-finalizer.service @@ -0,0 +1,11 @@ +[Unit] +Description=Monitor warm recovery and disable warmboot when done +Requires=database.service +After=database.service + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/finalize-warmboot.sh + +[Install] +WantedBy=multi-user.target diff --git a/files/initramfs-tools/mgmt-intf-dhcp b/files/initramfs-tools/mgmt-intf-dhcp deleted file mode 100644 index 52f7ff5f495c..000000000000 --- a/files/initramfs-tools/mgmt-intf-dhcp +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh - -PREREQS="union-mount" - -prereqs() { echo "$PREREQS"; } - -case $1 in - prereqs) - prereqs - exit 0 - ;; -esac - -# Extract kernel parameters -set -- $(cat /proc/cmdline) -for x in "$@"; do - case "$x" in - mgmt-intf-dhcp=*) - val="${x#mgmt-intf-dhcp=}" - - if [ -z "$val" ]; then - echo "ERROR: mgmt-intf-dhcp value (on/off) not specified !" - exit 0 - fi - - if [ -e "${rootmnt}/etc/network/interfaces" ]; then - if [ "$val" = "off" ]; then - sed -i 's/iface eth0 inet dhcp/iface eth0 inet static/g' ${rootmnt}/etc/network/interfaces - elif [ "$val" = "on" ]; then - sed -i 's/iface eth0 inet static/iface eth0 inet dhcp/g' ${rootmnt}/etc/network/interfaces - fi - fi - - ;; - esac -done diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh index 70b81383fa44..780051def9e6 100755 --- a/files/scripts/swss.sh +++ b/files/scripts/swss.sh @@ -7,6 +7,7 @@ LOCKFILE="/tmp/swss-syncd-lock" function debug() { + /usr/bin/logger $1 /bin/echo `date` "- $1" >> ${DEBUGLOG} } @@ -29,8 +30,8 @@ function unlock_service_state_change() function check_warm_boot() { - SYSTEM_WARM_START=`/usr/bin/redis-cli -n 4 hget "WARM_RESTART|system" enable` - SERVICE_WARM_START=`/usr/bin/redis-cli -n 4 hget "WARM_RESTART|${SERVICE}" enable` + SYSTEM_WARM_START=`/usr/bin/redis-cli -n 6 hget "WARM_RESTART_ENABLE_TABLE|system" enable` + SERVICE_WARM_START=`/usr/bin/redis-cli -n 6 hget "WARM_RESTART_ENABLE_TABLE|${SERVICE}" enable` if [[ x"$SYSTEM_WARM_START" == x"true" ]] || [[ x"$SERVICE_WARM_START" == x"true" ]]; then WARM_BOOT="true" else @@ -77,6 +78,14 @@ function clean_up_tables() end" 0 } +startPeerService() { + check_warm_boot + + if [[ x"$WARM_BOOT" != x"true" ]]; then + /bin/systemctl start ${PEER} + fi +} + start() { debug "Starting ${SERVICE} service..." @@ -90,10 +99,12 @@ start() { # Don't flush DB during warm boot if [[ x"$WARM_BOOT" != x"true" ]]; then + debug "Flushing APP, ASIC, COUNTER, CONFIG, and partial STATE databases ..." /usr/bin/docker exec database redis-cli -n 0 FLUSHDB + /usr/bin/docker exec database redis-cli -n 1 FLUSHDB /usr/bin/docker exec database redis-cli -n 2 FLUSHDB /usr/bin/docker exec database redis-cli -n 5 FLUSHDB - clean_up_tables 6 "'PORT_TABLE*', 'MGMT_PORT_TABLE*', 'VLAN_TABLE*', 'VLAN_MEMBER_TABLE*', 'INTERFACE_TABLE*', 'MIRROR_SESSION*'" + clean_up_tables 6 "'PORT_TABLE*', 'MGMT_PORT_TABLE*', 'VLAN_TABLE*', 'VLAN_MEMBER_TABLE*', 'INTERFACE_TABLE*', 'MIRROR_SESSION*', 'VRF_TABLE*'" fi # start service docker @@ -102,11 +113,11 @@ start() { # Unlock has to happen before reaching out to peer service unlock_service_state_change +} - if [[ x"$WARM_BOOT" != x"true" ]]; then - /bin/systemctl start ${PEER} - fi - /usr/bin/${SERVICE}.sh attach +wait() { + startPeerService + /usr/bin/${SERVICE}.sh wait } stop() { @@ -131,11 +142,11 @@ stop() { } case "$1" in - start|stop) + start|wait|stop) $1 ;; *) - echo "Usage: $0 {start|stop}" + echo "Usage: $0 {start|wait|stop}" exit 1 ;; esac diff --git a/files/scripts/syncd.sh b/files/scripts/syncd.sh index bef8ff11558c..0a2b9aefd0df 100755 --- a/files/scripts/syncd.sh +++ b/files/scripts/syncd.sh @@ -7,6 +7,7 @@ LOCKFILE="/tmp/swss-syncd-lock" function debug() { + /usr/bin/logger $1 /bin/echo `date` "- $1" >> ${DEBUGLOG} } @@ -29,8 +30,8 @@ function unlock_service_state_change() function check_warm_boot() { - SYSTEM_WARM_START=`/usr/bin/redis-cli -n 4 hget "WARM_RESTART|system" enable` - SERVICE_WARM_START=`/usr/bin/redis-cli -n 4 hget "WARM_RESTART|${SERVICE}" enable` + SYSTEM_WARM_START=`/usr/bin/redis-cli -n 6 hget "WARM_RESTART_ENABLE_TABLE|system" enable` + SERVICE_WARM_START=`/usr/bin/redis-cli -n 6 hget "WARM_RESTART_ENABLE_TABLE|${SERVICE}" enable` # SYSTEM_WARM_START could be empty, always make WARM_BOOT meaningful. if [[ x"$SYSTEM_WARM_START" == x"true" ]] || [[ x"$SERVICE_WARM_START" == x"true" ]]; then WARM_BOOT="true" @@ -87,9 +88,6 @@ start() { touch /host/warmboot/warm-starting else rm -f /host/warmboot/warm-starting - - # Flush DB during non-warm start - /usr/bin/docker exec database redis-cli -n 1 FLUSHDB fi # platform specific tasks @@ -119,7 +117,10 @@ start() { debug "Started ${SERVICE} service..." unlock_service_state_change - /usr/bin/${SERVICE}.sh attach +} + +wait() { + /usr/bin/${SERVICE}.sh wait } stop() { @@ -153,16 +154,11 @@ stop() { # platform specific tasks - # stop mellanox driver regardless of - # shutdown type - if [ x$sonic_asic_platform == x'mellanox' ]; then - /etc/init.d/sxdkernel stop - /usr/bin/mst stop - fi - - if [[ x"$WARM_BOOT" != x"true" ]]; then - if [ x$sonic_asic_platform == x'cavium' ]; then + if [ x$sonic_asic_platform == x'mellanox' ]; then + /etc/init.d/sxdkernel stop + /usr/bin/mst stop + elif [ x$sonic_asic_platform == x'cavium' ]; then /etc/init.d/xpnet.sh stop /etc/init.d/xpnet.sh start fi @@ -172,11 +168,11 @@ stop() { } case "$1" in - start|stop) + start|wait|stop) $1 ;; *) - echo "Usage: $0 {start|stop}" + echo "Usage: $0 {start|wait|stop}" exit 1 ;; esac diff --git a/files/sshd/host-ssh-keygen.sh b/files/sshd/host-ssh-keygen.sh index ade24e6383de..d4ea5bd431c1 100755 --- a/files/sshd/host-ssh-keygen.sh +++ b/files/sshd/host-ssh-keygen.sh @@ -1,10 +1,8 @@ #!/bin/bash +set -e + [ -r /etc/ssh/ssh_host_rsa_key ] || { rm -f /etc/ssh/ssh_host_*_key* /usr/bin/ssh-keygen -t rsa -N '' -f /etc/ssh/ssh_host_rsa_key - /usr/bin/ssh-keygen -t dsa -N '' -f /etc/ssh/ssh_host_dsa_key - /usr/bin/ssh-keygen -t rsa1 -N '' -f /etc/ssh/ssh_host_key - /usr/bin/ssh-keygen -t ecdsa -N '' -f /etc/ssh/ssh_host_ecdsa_key - /usr/bin/ssh-keygen -t ed25519 -N '' -f /etc/ssh/ssh_host_ed25519_key } diff --git a/platform/barefoot/bfn-platform.mk b/platform/barefoot/bfn-platform.mk deleted file mode 100644 index 211b4886c78c..000000000000 --- a/platform/barefoot/bfn-platform.mk +++ /dev/null @@ -1,5 +0,0 @@ -BFN_PLATFORM = bfnplatform_8.5.x.59217b4.deb -$(BFN_PLATFORM)_URL = "https://github.com/barefootnetworks/sonic-release-pkgs/raw/rel_8_5/bfnplatform_8.5.x.59217b4.deb" - -SONIC_ONLINE_DEBS += $(BFN_PLATFORM) # $(BFN_SAI_DEV) -$(BFN_SAI_DEV)_DEPENDS += $(BFN_PLATFORM) diff --git a/platform/barefoot/bfn-sai.mk b/platform/barefoot/bfn-sai.mk deleted file mode 100644 index a735ea777b62..000000000000 --- a/platform/barefoot/bfn-sai.mk +++ /dev/null @@ -1,5 +0,0 @@ -BFN_SAI = bfnsdk_8.5.x.59217b4.deb -$(BFN_SAI)_URL = "https://github.com/barefootnetworks/sonic-release-pkgs/raw/rel_8_5/bfnsdk_8.5.x.59217b4.deb" - -SONIC_ONLINE_DEBS += $(BFN_SAI) # $(BFN_SAI_DEV) -$(BFN_SAI_DEV)_DEPENDS += $(BFN_SAI) diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index 081a83e94ea9..b10414d26242 100755 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -34,6 +34,9 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(QUANTA_IX1B_32X_PLATFORM_MODULE) \ $(MITAC_LY1200_32X_PLATFORM_MODULE) \ $(ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE) \ - $(ALPHANETWORKS_SNH60B0_640F_PLATFORM_MODULE) + $(ALPHANETWORKS_SNH60B0_640F_PLATFORM_MODULE) \ + $(CEL_PHALANX_PLATFORM_MODULE) \ + $(CEL_FISHBONE48_PLATFORM_MODULE) \ + $(CEL_FISHBONE32_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/broadcom/platform-modules-cel.mk b/platform/broadcom/platform-modules-cel.mk index 1224faaa6750..9aebbf1a15ca 100644 --- a/platform/broadcom/platform-modules-cel.mk +++ b/platform/broadcom/platform-modules-cel.mk @@ -1,10 +1,16 @@ -# Celestica DX010 and Haliburton Platform modules +# Celestica platform modules -CEL_DX010_PLATFORM_MODULE_VERSION = 0.9 -CEL_HALIBURTON_PLATFORM_MODULE_VERSION = 0.9 +CEL_DX010_PLATFORM_MODULE_VERSION = 1.0 +CEL_HALIBURTON_PLATFORM_MODULE_VERSION = 1.0 +CEL_PHALANX_PLATFORM_MODULE_VERSION = 1.0 +CEL_FISHBONE48_PLATFORM_MODULE_VERSION = 1.0 +CEL_FISHBONE32_PLATFORM_MODULE_VERSION = 1.0 export CEL_DX010_PLATFORM_MODULE_VERSION export CEL_HALIBURTON_PLATFORM_MODULE_VERSION +export CEL_PHALANX_PLATFORM_MODULE_VERSION +export CEL_FISHBONE48_PLATFORM_MODULE_VERSION +export CEL_FISHBONE32_PLATFORM_MODULE_VERSION CEL_DX010_PLATFORM_MODULE = platform-modules-dx010_$(CEL_DX010_PLATFORM_MODULE_VERSION)_amd64.deb $(CEL_DX010_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-cel @@ -16,4 +22,16 @@ CEL_HALIBURTON_PLATFORM_MODULE = platform-modules-haliburton_$(CEL_HALIBURTON_PL $(CEL_HALIBURTON_PLATFORM_MODULE)_PLATFORM = x86_64-cel_e1031-r0 $(eval $(call add_extra_package,$(CEL_DX010_PLATFORM_MODULE),$(CEL_HALIBURTON_PLATFORM_MODULE))) +CEL_PHALANX_PLATFORM_MODULE = platform-modules-phalanx_$(CEL_PHALANX_PLATFORM_MODULE_VERSION)_amd64.deb +$(CEL_PHALANX_PLATFORM_MODULE)_PLATFORM = x86_64-alibaba_as23-128h-cl-r0 +$(eval $(call add_extra_package,$(CEL_DX010_PLATFORM_MODULE),$(CEL_PHALANX_PLATFORM_MODULE))) + +CEL_FISHBONE48_PLATFORM_MODULE = platform-modules-fishbone48_$(CEL_FISHBONE48_PLATFORM_MODULE_VERSION)_amd64.deb +$(CEL_FISHBONE48_PLATFORM_MODULE)_PLATFORM = x86_64-alibaba_as13-48f8h-cl-r0 +$(eval $(call add_extra_package,$(CEL_DX010_PLATFORM_MODULE),$(CEL_FISHBONE48_PLATFORM_MODULE))) + +CEL_FISHBONE32_PLATFORM_MODULE = platform-modules-fishbone32_$(CEL_FISHBONE32_PLATFORM_MODULE_VERSION)_amd64.deb +$(CEL_FISHBONE32_PLATFORM_MODULE)_PLATFORM = x86_64-alibaba_as13-32h-cl-r0 +$(eval $(call add_extra_package,$(CEL_DX010_PLATFORM_MODULE),$(CEL_FISHBONE32_PLATFORM_MODULE))) + SONIC_STRETCH_DEBS += $(CEL_DX010_PLATFORM_MODULE) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index 85eb0df51870..b8fb9ff4ac96 100644 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -22,10 +22,10 @@ include $(PLATFORM_PATH)/libsaithrift-dev.mk include $(PLATFORM_PATH)/docker-ptf-brcm.mk BCMCMD = bcmcmd -$(BCMCMD)_URL = "https://sonicstorage.blob.core.windows.net/packages/20170518/bcmcmd?sv=2015-04-05&sr=b&sig=OCW4mfmbQ6D0BH8nllpAWrS8XL9uczrw32w3XgL4jws%3D&se=2030-03-31T23%3A06%3A15Z&sp=r" +$(BCMCMD)_URL = "https://sonicstorage.blob.core.windows.net/packages/20190307/bcmcmd?sv=2015-04-05&sr=b&sig=sUdbU7oVbh5exbXXHVL5TDFBTWDDBASHeJ8Cp0B0TIc%3D&se=2038-05-06T22%3A34%3A19Z&sp=r" DSSERVE = dsserve -$(DSSERVE)_URL = "https://sonicstorage.blob.core.windows.net/packages/20170518/dsserve?sv=2015-04-05&sr=b&sig=gyNbgSL%2FvpMXDdpboVkIJcTKMRdGgEaOR9OukHhEsu8%3D&se=2030-03-31T23%3A06%3A35Z&sp=r" +$(DSSERVE)_URL = "https://sonicstorage.blob.core.windows.net/packages/20190307/dsserve?sv=2015-04-05&sr=b&sig=lk7BH3DtW%2F5ehc0Rkqfga%2BUCABI0UzQmDamBsZH9K6w%3D&se=2038-05-06T22%3A34%3A45Z&sp=r" SONIC_ONLINE_FILES += $(BCMCMD) $(DSSERVE) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 4ee0e4372224..61fcc34549b8 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.3.3.1-3_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/3.3/libsaibcm_3.3.3.1-3_amd64.deb?sv=2015-04-05&sr=b&sig=LcClnc7O9BUMfh6nYVNr76UAjLxVMtGztoH24qcY5rk%3D&se=2032-08-24T21%3A56%3A57Z&sp=r" +BRCM_SAI = libsaibcm_3.3.4.3-2_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/3.3/libsaibcm_3.3.4.3-2_amd64.deb?sv=2015-04-05&sr=b&sig=GO2B4zoVJi0j0%2FZKbf8yhRL0oQ3clJEZFiy2AC14xSc%3D&se=2032-10-20T20%3A38%3A13Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.3.3.1-3_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.3.4.3-2_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/3.3/libsaibcm-dev_3.3.3.1-3_amd64.deb?sv=2015-04-05&sr=b&sig=OS4wTDTjFVZMFKKFx0hKtZEKUDbOyLO69gqIUaM3I4M%3D&se=2032-08-24T21%3A56%3A25Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/3.3/libsaibcm-dev_3.3.4.3-2_amd64.deb?sv=2015-04-05&sr=b&sig=aYEpjYMEIqfMnAiraXr9K%2FspEb8d2qGdwcIBxO3%2BjjY%3D&se=2032-10-20T20%3A37%3A51Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) diff --git a/platform/broadcom/sonic-platform-modules-accton/common/modules/accton_i2c_cpld.c b/platform/broadcom/sonic-platform-modules-accton/common/modules/accton_i2c_cpld.c old mode 100644 new mode 100755 index aae4e5538b63..3712d1a39623 --- a/platform/broadcom/sonic-platform-modules-accton/common/modules/accton_i2c_cpld.c +++ b/platform/broadcom/sonic-platform-modules-accton/common/modules/accton_i2c_cpld.c @@ -194,7 +194,7 @@ struct attrs plain_common[] = { struct base_attrs portly_attrs[] = { [SFP_PRESENT] = {"module_present", S_IRUGO, show_bit, NULL}, - [SFP_RESET] = {"module_reset", S_IRUGO|S_IWUGO, show_bit, set_1bit}, + [SFP_RESET] = {"module_reset", S_IRUGO|S_IWUSR, show_bit, set_1bit}, }; struct attrs as7712_port[] = { diff --git a/platform/broadcom/sonic-platform-modules-cel b/platform/broadcom/sonic-platform-modules-cel new file mode 160000 index 000000000000..b319df9c68b2 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel @@ -0,0 +1 @@ +Subproject commit b319df9c68b29686d072f25c6931bba75b176540 diff --git a/platform/broadcom/sonic-platform-modules-cel/.gitignore b/platform/broadcom/sonic-platform-modules-cel/.gitignore deleted file mode 100644 index 2490baa9d1e2..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/.gitignore +++ /dev/null @@ -1,59 +0,0 @@ -# Prerequisites -*.d - -# Object files -*.o -*.ko -*.obj -*.elf - -# Linker output -*.ilk -*.map -*.exp - -# Precompiled Headers -*.gch -*.pch - -# Libraries -*.lib -*.a -*.la -*.lo - -# Shared objects (inc. Windows DLLs) -*.dll -*.so -*.so.* -*.dylib - -# Executables -*.exe -*.out -*.app -*.i*86 -*.x86_64 -*.hex - -# Debug files -*.dSYM/ -*.su -*.idb -*.pdb - -# Kernel Module Compile Results -*.mod* -*.cmd -.tmp_versions/ -modules.order -Module.symvers -Mkfile.old -dkms.conf - -# Debian packaging -*.debhelper.log -*.postinst.debhelper -*.postrm.debhelper -*.prerm.debhelper -*.substvars diff --git a/platform/broadcom/sonic-platform-modules-cel/LICENSE b/platform/broadcom/sonic-platform-modules-cel/LICENSE deleted file mode 100644 index 2386a3920c07..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -Copyright (C) 2017 Celestica, Inc - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/platform/broadcom/sonic-platform-modules-cel/README.md b/platform/broadcom/sonic-platform-modules-cel/README.md deleted file mode 100644 index 26e45c685e44..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/README.md +++ /dev/null @@ -1 +0,0 @@ -platform drivers for Celestica DX010 and Haliburton for the SONiC project diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/changelog b/platform/broadcom/sonic-platform-modules-cel/debian/changelog deleted file mode 100644 index 843b028e4301..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/debian/changelog +++ /dev/null @@ -1,57 +0,0 @@ -sonic-cel-platform-modules (0.9) unstable; urgency=low - - * Add haliburton platform module. - - -- Wirut Getbamrung Fri, 17 Aug 2018 10:10:10 +0700 - -sonic-cel-platform-modules (0.8) unstable; urgency=low - - * Add dx010 platform fan led control. - * The platform gpio init moved to kernel space. - - -- Pradchaya Phucharoen Mon, 1 Jul 2018 11:09:13 +0700 - -sonic-cel-platform-modules (0.7) unstable; urgency=low - - * Add dx010 plaform gpio sysfs exported when module load. - - -- Pradchaya Phucharoen Wed, 21 Jun 2018 13:29:05 +0700 - -sonic-cel-platform-modules (0.6) unstable; urgency=low - - * Remove unused port-mode switch script. This should be done by hwsku config script. - * Add script to turn off QSFP low power mode when boot up. - - -- Pradchaya Phucharoen Wed, 26 July 2017 10:43:00 +0700 - -sonic-cel-platform-modules (0.5) unstable; urgency=low - - * Add port-mode switch script to support 100G 50G 10G_50G qsfp modes. - * Fix garbage data when using sfputil to read QSFP-transceiver's eeprom. - * Fix incorrect endian in eeprom read word data. - - -- Pradchaya Phucharoen Tue, 18 July 2017 11:30:00 +0700 - -sonic-cel-platform-modules (0.4) unstable; urgency=low - - * Add support for DX010's fancontrol, automatic run-up and FIX bug lpmod - - -- Pariwat Leamsumran Thu, 14 June 2017 16:25:00 +0700 - -sonic-cel-platform-modules (0.3) unstable; urgency=low - - * Add support for DX010's DPS800 - - -- Abhisit Sangjan Thu, 29 May 2017 19:23:00 +0700 - -sonic-cel-platform-modules (0.2) unstable; urgency=low - - * Add support for DX010's LM75B, Watchdog and EMC2305 - - -- Abhisit Sangjan Thu, 25 May 2017 15:26:00 +0700 - -sonic-cel-platform-modules (0.1) unstable; urgency=low - - * Initial release - - -- Abhisit Sangjan Mon, 2 May 2017 14:47:00 +0700 diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/compat b/platform/broadcom/sonic-platform-modules-cel/debian/compat deleted file mode 100644 index ec635144f600..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/control b/platform/broadcom/sonic-platform-modules-cel/debian/control deleted file mode 100644 index e76edfbeceed..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/debian/control +++ /dev/null @@ -1,17 +0,0 @@ -Source: sonic-cel-platform-modules -Section: main -Priority: extra -Maintainer: Abhisit Sangjan -Build-Depends: debhelper (>= 8.0.0), bzip2 -Standards-Version: 3.9.3 - -Package: platform-modules-dx010 -Architecture: amd64 -Depends: linux-image-4.9.0-8-amd64 -Description: kernel modules for platform devices such as fan, led, sfp - - -Package: platform-modules-haliburton -Architecture: amd64 -Depends: linux-image-4.9.0-8-amd64 -Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.init b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.init deleted file mode 100644 index 2117ab22b402..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.init +++ /dev/null @@ -1,147 +0,0 @@ -#!/bin/bash - -### BEGIN INIT INFO -# Provides: setup-board -# Required-Start: $portmap -# Required-Stop: -# Should-Start: -# Should-Stop: -# Default-Start: S -# Default-Stop: 0 6 -# Short-Description: Setup DX010 board. -### END INIT INFO - -function export_gpio { -label=$2 -gpio_num=$1 -gpio_base=`( cat /sys/class/gpio/gpiochip*/base | head -1 ) 2>/dev/null` -gpio_label=`( cat /sys/class/gpio/gpiochip*/label | head -1 ) 2>/dev/null` -if [[ "X$gpio_base" == "X" ]] || -( [[ "X$label" != "X" ]] && [[ "$label" != "$gpio_label" ]] ); then - echo "Platform driver error: No gpiochip found!" - exit 1; -fi -ionum=$((gpio_base+gpio_num)) -echo $ionum > /sys/class/gpio/export -if [ $? -ne 0 ]; then - echo "Platform driver error: Cannot export gpio$ionum!" - exit 1; -fi -} - -case "$1" in -start) - echo -n "Setting up board... " - - modprobe i2c-dev - modprobe i2c-mux-pca954x - modprobe dx010_wdt - modprobe leds-dx010 - modprobe lm75 - - found=0 - for devnum in 0 1; do - devname=`cat /sys/bus/i2c/devices/i2c-${devnum}/name` - # iSMT adapter can be at either dffd0000 or dfff0000 - if [[ $devname == 'SMBus iSMT adapter at '* ]]; then - found=1 - break - fi - done - - [ $found -eq 0 ] && echo "cannot find iSMT" && exit 1 - - i2cset -y ${devnum} 0x70 0x10 0x00 0x01 i - - # Attach PCA9541 Ox70 Master Selector - chmod 755 /sys/bus/i2c/devices/i2c-${devnum}/new_device - echo pca9541 0x70 > /sys/bus/i2c/devices/i2c-${devnum}/new_device - sleep 1 - - # Attach PCA9548 0x71 Channel Extender for Main Board - echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-${devnum}/new_device - sleep 1 - - # Attach PCA9548 0x73 Channel Extender for CPU Board - echo pca9548 0x73 > /sys/bus/i2c/devices/i2c-${devnum}/new_device - sleep 1 - - # Attach PCA9548 0x77 Channel Extender for Fan's EEPROMs - echo pca9548 0x77 > /sys/bus/i2c/devices/i2c-${devnum}/new_device - sleep 1 - - # Attach syseeprom - echo 24lc64t 0x50 > /sys/bus/i2c/devices/i2c-12/new_device - - # Attach temperature sensors - echo lm75b 0x48 > /sys/bus/i2c/devices/i2c-5/new_device - echo lm75b 0x49 > /sys/bus/i2c/devices/i2c-6/new_device - echo lm75b 0x4a > /sys/bus/i2c/devices/i2c-7/new_device - echo lm75b 0x48 > /sys/bus/i2c/devices/i2c-14/new_device - echo lm75b 0x4e > /sys/bus/i2c/devices/i2c-15/new_device - - # Attach fans - echo emc2305 0x2e > /sys/bus/i2c/devices/i2c-13/new_device - echo emc2305 0x4d > /sys/bus/i2c/devices/i2c-13/new_device - - # Attach PSUs - echo dps460 0x5a > /sys/bus/i2c/devices/i2c-10/new_device - echo dps460 0x5b > /sys/bus/i2c/devices/i2c-11/new_device - - # Attach PCA9506 GPIO expander for 40 pins - echo pca9505 0x20 > /sys/bus/i2c/devices/i2c-17/new_device - - modprobe dx010_cpld - sleep 2 - - # Export platform gpio sysfs - export_gpio 10 # Fan 1 present - export_gpio 11 # Fan 2 present - export_gpio 12 # Fan 3 present - export_gpio 13 # Fan 4 present - export_gpio 14 # Fan 5 present - - export_gpio 22 # PSU L PWOK - export_gpio 25 # PSU R PWOK - export_gpio 27 # PSU L ABS - export_gpio 28 # PSU R ABS - - export_gpio 29 # Fan 1 LED: Red - export_gpio 30 # Fan 1 LED: Yellow - export_gpio 31 # Fan 2 LED: Red - export_gpio 32 # Fan 2 LED: Yellow - export_gpio 33 # Fan 3 LED: Red - export_gpio 34 # Fan 3 LED: Yellow - export_gpio 35 # Fan 4 LED: Red - export_gpio 36 # Fan 4 LED: Yellow - export_gpio 37 # Fan 5 LED: Red - export_gpio 38 # Fan 5 LED: Yellow - - # Turn off/down lpmod by defult (0 - Normal, 1 - Low Pow) - echo 0x00000000 > /sys/devices/platform/dx010_cpld/qsfp_lpmode - - # Attach 32 instances of EEPROM driver QSFP ports - for ((n=26;n<=58;n++)); - do - echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-$n/new_device - sleep 0.1 - done - - echo "done." - ;; - -stop) - echo "done." - ;; - -force-reload|restart) - echo "Not supported" - ;; - -*) - echo "Usage: /etc/init.d/platform-modules-dx010.init {start|stop}" - exit 1 - ;; -esac - -exit 0 diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.install b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.install deleted file mode 100644 index b25d47022b08..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.install +++ /dev/null @@ -1,3 +0,0 @@ -dx010/scripts/dx010_check_qsfp.sh usr/local/bin -dx010/cfg/dx010-modules.conf etc/modules-load.d -dx010/systemd/platform-modules-dx010.service lib/systemd/system diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.postinst b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.postinst deleted file mode 100644 index baff704171c7..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.postinst +++ /dev/null @@ -1,3 +0,0 @@ -depmod -a -systemctl enable platform-modules-dx010.service -systemctl start platform-modules-dx010.service 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 deleted file mode 100644 index 5192b202a3f9..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.init +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/bash - -### BEGIN INIT INFO -# Provides: setup-board -# Required-Start: $portmap -# Required-Stop: -# Should-Start: -# Should-Stop: -# Default-Start: S -# Default-Stop: 0 6 -# Short-Description: Setup Haliburton board. -### END INIT INFO - -case "$1" in -start) - echo -n "Setting up board... " - - modprobe smc - - found=0 - for devnum in 0 1; do - devname=`cat /sys/bus/i2c/devices/i2c-${devnum}/name` - # iSMT adapter can be at either dffd0000 or dfff0000 - if [[ $devname == 'SMBus iSMT adapter at '* ]]; then - found=1 - break - fi - done - - [ $found -eq 0 ] && echo "cannot find iSMT" && exit 1 - - i2cset -y ${devnum} 0x73 0x10 0x00 0x01 i - - # Attach PCA9548 0x73 Channel Extender for CPU Board - echo pca9548 0x73 > /sys/bus/i2c/devices/i2c-${devnum}/new_device - sleep 1 - - # Attach PCA9541 Ox71 Master Selector - chmod 755 /sys/bus/i2c/devices/i2c-${devnum}/new_device - echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-8/new_device - sleep 1 - - # Attach PCA9548 0x72 Channel Extender for Main Board - echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-8/new_device - sleep 1 - - # Attach syseeprom - echo 24lc64t 0x50 > /sys/bus/i2c/devices/i2c-2/new_device - - echo max6697 0x1a > /sys/bus/i2c/devices/i2c-3/new_device - echo max6697 0x1a > /sys/bus/i2c/devices/i2c-11/new_device - - - # Attach fans - echo emc2305 0x4d > /sys/bus/i2c/devices/i2c-23/new_device - - # Attach 4 SFP+ Uplink - echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-14/new_device - echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-15/new_device - echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-16/new_device - echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-17/new_device - - # Enable SFP module presence interrupt - echo "both" > /sys/devices/platform/e1031.smc/SFP/modabs_trig - echo 0 > /sys/devices/platform/e1031.smc/SFP/modabs_mask - - echo "done." - ;; - -stop) - echo "done." - ;; - -force-reload|restart) - echo "Not supported" - ;; - -*) - echo "Usage: /etc/init.d/platform-modules-haliburton.init {start|stop}" - exit 1 - ;; -esac - -exit 0 diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.install b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.install deleted file mode 100644 index 93b2eed633d1..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.install +++ /dev/null @@ -1,2 +0,0 @@ -haliburton/cfg/haliburton-modules.conf etc/modules-load.d -haliburton/systemd/platform-modules-haliburton.service lib/systemd/system 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 deleted file mode 100644 index bdc23c66d5a4..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.postinst +++ /dev/null @@ -1,3 +0,0 @@ -depmod -a -systemctl enable platform-modules-haliburton.service -systemctl start platform-modules-haliburton.service diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/rules b/platform/broadcom/sonic-platform-modules-cel/debian/rules deleted file mode 100755 index 5086302b70b2..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/debian/rules +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/make -f - -export INSTALL_MOD_DIR:=extra - -KVERSION ?= $(shell uname -r) -KERNEL_SRC := /lib/modules/$(KVERSION) -MOD_SRC_DIR:= $(shell pwd) -MODULE_DIRS:= dx010 haliburton - -%: - dh $@ - -override_dh_auto_build: - (for mod in $(MODULE_DIRS); do \ - make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \ - done) - -override_dh_auto_install: - (for mod in $(MODULE_DIRS); do \ - dh_installdirs -pplatform-modules-$${mod} \ - $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ - cp $(MOD_SRC_DIR)/$${mod}/modules/*.ko \ - debian/platform-modules-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ - done) - -override_dh_usrlocal: - -override_dh_clean: - dh_clean - (for mod in $(MODULE_DIRS); do \ - make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules clean; \ - done) - diff --git a/platform/broadcom/sonic-platform-modules-cel/dx010/cfg/dx010-modules.conf b/platform/broadcom/sonic-platform-modules-cel/dx010/cfg/dx010-modules.conf deleted file mode 100644 index 66f002a5fc94..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/dx010/cfg/dx010-modules.conf +++ /dev/null @@ -1,15 +0,0 @@ -# /etc/modules: kernel modules to load at boot time. -# -# This file contains the names of kernel modules that should be loaded -# at boot time, one per line. Lines beginning with "#" are ignored. - -i2c-i801 -i2c-isch -i2c-ismt -i2c-dev -i2c-mux -i2c-smbus - -i2c-mux-gpio -i2c-mux-pca954x - diff --git a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/Makefile b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/Makefile deleted file mode 100644 index 9b0f10604811..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/Makefile +++ /dev/null @@ -1 +0,0 @@ -obj-m := dx010_cpld.o mc24lc64t.o emc2305.o dx010_wdt.o leds-dx010.o \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/dx010_cpld.c b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/dx010_cpld.c deleted file mode 100644 index 397361a5edd6..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/dx010_cpld.c +++ /dev/null @@ -1,561 +0,0 @@ -/* - * dx010_cpld.c - driver for SeaStone's CPLD - * - * Copyright (C) 2017 Celestica Corp. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define DRIVER_NAME "dx010_cpld" - -#define RESET0108 0x250 -#define RESET0910 0x251 -#define RESET1118 0x2d0 -#define RESET1921 0x2d1 -#define RESET2229 0x3d0 -#define RESET3032 0x3d1 - -#define LPMOD0108 0x252 -#define LPMOD0910 0x253 -#define LPMOD1118 0x2d2 -#define LPMOD1921 0x2d3 -#define LPMOD2229 0x3d2 -#define LPMOD3032 0x3d3 - -#define ABS0108 0x254 -#define ABS0910 0x255 -#define ABS1118 0x2d4 -#define ABS1921 0x2d5 -#define ABS2229 0x3d4 -#define ABS3032 0x3d5 - -#define INT0108 0x256 -#define INT0910 0x257 -#define INT1118 0x2d6 -#define INT1921 0x2d7 -#define INT2229 0x3d6 -#define INT3032 0x3d7 - - -#define LENGTH_PORT_CPLD 34 -#define PORT_BANK1_START 1 -#define PORT_BANK1_END 10 -#define PORT_BANK2_START 11 -#define PORT_BANK2_END 21 -#define PORT_BANK3_START 22 -#define PORT_BANK3_END 32 -#define PORT_SFPP1 33 -#define PORT_SFPP2 34 - -#define PORT_ID_BANK1 0x210 -#define PORT_ID_BANK2 0x290 -#define PORT_ID_BANK3 0x390 - -#define OPCODE_ID_BANK1 0x211 -#define OPCODE_ID_BANK2 0x291 -#define OPCODE_ID_BANK3 0x391 - -#define DEVADDR_ID_BANK1 0x212 -#define DEVADDR_ID_BANK2 0x292 -#define DEVADDR_ID_BANK3 0x392 - -#define CMDBYT_ID_BANK1 0x213 -#define CMDBYT_ID_BANK2 0x293 -#define CMDBYT_ID_BANK3 0x393 - -#define WRITE_ID_BANK1 0x220 -#define WRITE_ID_BANK2 0x2A0 -#define WRITE_ID_BANK3 0x3A0 - -#define READ_ID_BANK1 0x230 -#define READ_ID_BANK2 0x2B0 -#define READ_ID_BANK3 0x3B0 - -#define SSRR_ID_BANK1 0x216 -#define SSRR_ID_BANK2 0x296 -#define SSRR_ID_BANK3 0x396 - -#define HST_CNTL2_QUICK 0x00 -#define HST_CNTL2_BYTE 0x01 -#define HST_CNTL2_BYTE_DATA 0x02 -#define HST_CNTL2_WORD_DATA 0x03 -#define HST_CNTL2_BLOCK 0x05 - -struct dx010_i2c_data { - int portid; -}; - -struct dx010_cpld_data { - struct i2c_adapter *i2c_adapter[LENGTH_PORT_CPLD]; - struct mutex cpld_lock; -}; - -struct dx010_cpld_data *cpld_data; - -static ssize_t get_reset(struct device *dev, struct device_attribute *devattr, - char *buf) -{ - unsigned long reset = 0; - - mutex_lock(&cpld_data->cpld_lock); - - reset = - (inb(RESET3032) & 0x07) << (24+5) | - inb(RESET2229) << (24-3) | - (inb(RESET1921) & 0x07) << (16 + 2) | - inb(RESET1118) << (16-6) | - (inb(RESET0910) & 0x03 ) << 8 | - inb(RESET0108); - - mutex_unlock(&cpld_data->cpld_lock); - - return sprintf(buf,"0x%8.8lx\n", reset & 0xffffffff); -} - -static ssize_t set_reset(struct device *dev, struct device_attribute *devattr, - const char *buf, size_t count) -{ - unsigned long reset; - int err; - - mutex_lock(&cpld_data->cpld_lock); - - err = kstrtoul(buf, 16, &reset); - if (err) - { - mutex_unlock(&cpld_data->cpld_lock); - return err; - } - - outb( (reset >> 0) & 0xFF, RESET0108); - outb( (reset >> 8) & 0x03, RESET0910); - outb( (reset >> 10) & 0xFF, RESET1118); - outb( (reset >> 18) & 0x07, RESET1921); - outb( (reset >> 21) & 0xFF, RESET2229); - outb( (reset >> 29) & 0x07, RESET3032); - - mutex_unlock(&cpld_data->cpld_lock); - - return count; -} - -static ssize_t get_lpmode(struct device *dev, struct device_attribute *devattr, - char *buf) -{ - unsigned long lpmod = 0; - - mutex_lock(&cpld_data->cpld_lock); - - lpmod = - (inb(LPMOD3032) & 0x07) << (24+5) | - inb(LPMOD2229) << (24-3) | - (inb(LPMOD1921) & 0x07) << (16 + 2) | - inb(LPMOD1118) << (16-6) | - (inb(LPMOD0910) & 0x03 ) << 8 | - inb(LPMOD0108); - - mutex_unlock(&cpld_data->cpld_lock); - - return sprintf(buf,"0x%8.8lx\n", lpmod & 0xffffffff); -} - -static ssize_t set_lpmode(struct device *dev, struct device_attribute *devattr, - const char *buf, size_t count) -{ - unsigned long lpmod; - int err; - - mutex_lock(&cpld_data->cpld_lock); - - err = kstrtoul(buf, 16, &lpmod); - if (err) - { - mutex_unlock(&cpld_data->cpld_lock); - return err; - } - - outb( (lpmod >> 0) & 0xFF, LPMOD0108); - outb( (lpmod >> 8) & 0x03, LPMOD0910); - outb( (lpmod >> 10) & 0xFF, LPMOD1118); - outb( (lpmod >> 18) & 0x07, LPMOD1921); - outb( (lpmod >> 21) & 0xFF, LPMOD2229); - outb( (lpmod >> 29) & 0x07, LPMOD3032); - - mutex_unlock(&cpld_data->cpld_lock); - - return count; -} - -static ssize_t get_modprs(struct device *dev, struct device_attribute *devattr, - char *buf) -{ - unsigned long present; - - mutex_lock(&cpld_data->cpld_lock); - - present = - (inb(ABS3032) & 0x07) << (24+5) | - inb(ABS2229) << (24-3) | - (inb(ABS1921) & 0x07) << (16 + 2) | - inb(ABS1118) << (16-6) | - (inb(ABS0910) & 0x03) << 8 | - inb(ABS0108); - - mutex_unlock(&cpld_data->cpld_lock); - - return sprintf(buf,"0x%8.8lx\n", present & 0xffffffff); -} - -static ssize_t get_modirq(struct device *dev, struct device_attribute *devattr, - char *buf) -{ - unsigned long irq; - - mutex_lock(&cpld_data->cpld_lock); - - irq = - (inb(INT3032) & 0x07) << (24+5) | - inb(INT2229) << (24-3) | - (inb(INT1921) & 0x07) << (16 + 2) | - inb(INT1118) << (16-6) | - (inb(INT0910) & 0x03) << 8 | - inb(INT0108); - - mutex_unlock(&cpld_data->cpld_lock); - - return sprintf(buf,"0x%8.8lx\n", irq & 0xffffffff); -} - -static DEVICE_ATTR(qsfp_reset, S_IRUGO | S_IWUSR, get_reset, set_reset); -static DEVICE_ATTR(qsfp_lpmode, S_IRUGO | S_IWUSR, get_lpmode, set_lpmode); -static DEVICE_ATTR(qsfp_modprs, S_IRUGO, get_modprs, NULL); -static DEVICE_ATTR(qsfp_modirq, S_IRUGO, get_modirq, NULL); - -static struct attribute *dx010_lpc_attrs[] = { - &dev_attr_qsfp_reset.attr, - &dev_attr_qsfp_lpmode.attr, - &dev_attr_qsfp_modprs.attr, - &dev_attr_qsfp_modirq.attr, - NULL, -}; - -static struct attribute_group dx010_lpc_attr_grp = { - .attrs = dx010_lpc_attrs, -}; - -static struct resource cel_dx010_lpc_resources[] = { - { - .flags = IORESOURCE_IO, - }, -}; - -static void cel_dx010_lpc_dev_release( struct device * dev) -{ - return; -} - -static struct platform_device cel_dx010_lpc_dev = { - .name = DRIVER_NAME, - .id = -1, - .num_resources = ARRAY_SIZE(cel_dx010_lpc_resources), - .resource = cel_dx010_lpc_resources, - .dev = { - .release = cel_dx010_lpc_dev_release, - } -}; - - -/** - * Read eeprom of QSFP device. - * @param a i2c adapter. - * @param addr address to read. - * @param new_data QSFP port number struct. - * @param cmd i2c command. - * @return 0 if not error, else the error code. - */ -static int i2c_read_eeprom(struct i2c_adapter *a, u16 addr, - struct dx010_i2c_data *new_data, u8 cmd, union i2c_smbus_data *data){ - - u32 reg; - int ioBase=0; - char byte; - short temp; - short portid, opcode, devaddr, cmdbyte0, ssrr, writedata, readdata; - __u16 word_data; - int error = -EIO; - - mutex_lock(&cpld_data->cpld_lock); - - if (((new_data->portid >= PORT_BANK1_START) - && (new_data->portid <= PORT_BANK1_END)) - || (new_data->portid == PORT_SFPP1) - || (new_data->portid == PORT_SFPP2)) - { - portid = PORT_ID_BANK1; - opcode = OPCODE_ID_BANK1; - devaddr = DEVADDR_ID_BANK1; - cmdbyte0 = CMDBYT_ID_BANK1; - ssrr = SSRR_ID_BANK1; - writedata = WRITE_ID_BANK1; - readdata = READ_ID_BANK1; - }else if ((new_data->portid >= PORT_BANK2_START) && (new_data->portid <= PORT_BANK2_END)){ - portid = PORT_ID_BANK2; - opcode = OPCODE_ID_BANK2; - devaddr = DEVADDR_ID_BANK2; - cmdbyte0 = CMDBYT_ID_BANK2; - ssrr = SSRR_ID_BANK2; - writedata = WRITE_ID_BANK2; - readdata = READ_ID_BANK2; - }else if ((new_data->portid >= PORT_BANK3_START) && (new_data->portid <= PORT_BANK3_END)){ - portid = PORT_ID_BANK3; - opcode = OPCODE_ID_BANK3; - devaddr = DEVADDR_ID_BANK3; - cmdbyte0 = CMDBYT_ID_BANK3; - ssrr = SSRR_ID_BANK3; - writedata = WRITE_ID_BANK3; - readdata = READ_ID_BANK3; - }else{ - /* Invalid parameter! */ - error = -EINVAL; - goto exit; - } - - while ((inb(ioBase + ssrr) & 0x40)); - if ((inb(ioBase + ssrr) & 0x80) == 0x80) { - error = -EIO; - /* Read error reset the port */ - outb(0x00, ioBase + ssrr); - udelay(3000); - outb(0x01, ioBase + ssrr); - goto exit; - } - - byte = 0x40 +new_data->portid; - reg = cmd; - outb(byte, ioBase + portid); - outb(reg,ioBase + cmdbyte0); - byte = 33; - outb(byte, ioBase + opcode); - addr = addr << 1; - addr |= 0x01; - outb(addr, ioBase + devaddr); - while ((inb(ioBase + ssrr) & 0x40)) - { - udelay(100); - } - - if ((inb(ioBase + ssrr) & 0x80) == 0x80) { - /* Read error reset the port */ - error = -EIO; - outb(0x00, ioBase + ssrr); - udelay(3000); - outb(0x01, ioBase + ssrr); - goto exit; - } - - temp = ioBase + readdata; - word_data = inb(temp); - word_data |= (inb(++temp) << 8); - - mutex_unlock(&cpld_data->cpld_lock); - data->word = word_data; - return 0; - -exit: - mutex_unlock(&cpld_data->cpld_lock); - return error; -} - -static int dx010_i2c_access(struct i2c_adapter *a, u16 addr, - unsigned short flags, char rw, u8 cmd, - int size, union i2c_smbus_data *data) -{ - - int error = 0; - - struct dx010_i2c_data *new_data; - - /* Write the command register */ - new_data = i2c_get_adapdata(a); - - /* Map the size to what the chip understands */ - switch (size) { - case I2C_SMBUS_QUICK: - size = HST_CNTL2_QUICK; - break; - case I2C_SMBUS_BYTE: - size = HST_CNTL2_BYTE; - break; - case I2C_SMBUS_BYTE_DATA: - size = HST_CNTL2_BYTE_DATA; - break; - case I2C_SMBUS_WORD_DATA: - size = HST_CNTL2_WORD_DATA; - break; - case I2C_SMBUS_BLOCK_DATA: - size = HST_CNTL2_BLOCK; - break; - default: - dev_warn(&a->dev, "Unsupported transaction %d\n", size); - error = -EOPNOTSUPP; - goto Done; - } - - switch (size) { - case HST_CNTL2_BYTE: /* Result put in SMBHSTDAT0 */ - break; - case HST_CNTL2_BYTE_DATA: - break; - case HST_CNTL2_WORD_DATA: - if( 0 == i2c_read_eeprom(a,addr,new_data,cmd,data)){ - error = 0; - }else{ - error = -EIO; - } - break; - } - -Done: - return error; -} - -static u32 dx010_i2c_func(struct i2c_adapter *a) -{ - return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | - I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | - I2C_FUNC_SMBUS_BLOCK_DATA; -} - -static const struct i2c_algorithm dx010_i2c_algorithm = { - .smbus_xfer = dx010_i2c_access, - .functionality = dx010_i2c_func, -}; - -static struct i2c_adapter * cel_dx010_i2c_init(struct platform_device *pdev, int portid) -{ - int error; - - struct i2c_adapter *new_adapter; - struct dx010_i2c_data *new_data; - - new_adapter = kzalloc(sizeof(*new_adapter), GFP_KERNEL); - if (!new_adapter) - return NULL; - - new_adapter->dev.parent = &pdev->dev; - new_adapter->owner = THIS_MODULE; - new_adapter->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; - new_adapter->algo = &dx010_i2c_algorithm; - - snprintf(new_adapter->name, sizeof(new_adapter->name), - "SMBus dx010 i2c Adapter portid@%04x", portid); - - new_data = kzalloc(sizeof(*new_data), GFP_KERNEL); - if (!new_data) - return NULL; - - new_data->portid = portid; - - i2c_set_adapdata(new_adapter,new_data); - - error = i2c_add_adapter(new_adapter); - if(error) - return NULL; - - return new_adapter; -}; - -static int cel_dx010_lpc_drv_probe(struct platform_device *pdev) -{ - struct resource *res; - int ret =0; - int portid_count; - - cpld_data = devm_kzalloc(&pdev->dev, sizeof(struct dx010_cpld_data), - GFP_KERNEL); - if (!cpld_data) - return -ENOMEM; - - mutex_init(&cpld_data->cpld_lock); - - res = platform_get_resource(pdev, IORESOURCE_IO, 0); - if (unlikely(!res)) { - printk(KERN_ERR " Specified Resource Not Available...\n"); - return -1; - } - - ret = sysfs_create_group(&pdev->dev.kobj, &dx010_lpc_attr_grp); - if (ret) { - printk(KERN_ERR "Cannot create sysfs\n"); - } - - for(portid_count=1 ; portid_count<=LENGTH_PORT_CPLD ; portid_count++) - cpld_data->i2c_adapter[portid_count-1] = - cel_dx010_i2c_init(pdev, portid_count); - - return 0; -} - -static int cel_dx010_lpc_drv_remove(struct platform_device *pdev) -{ - int portid_count; - - sysfs_remove_group(&pdev->dev.kobj, &dx010_lpc_attr_grp); - - for (portid_count=1 ; portid_count<=LENGTH_PORT_CPLD ; portid_count++) - i2c_del_adapter(cpld_data->i2c_adapter[portid_count-1]); - - return 0; -} - -static struct platform_driver cel_dx010_lpc_drv = { - .probe = cel_dx010_lpc_drv_probe, - .remove = __exit_p(cel_dx010_lpc_drv_remove), - .driver = { - .name = DRIVER_NAME, - }, -}; - -int cel_dx010_lpc_init(void) -{ - platform_device_register(&cel_dx010_lpc_dev); - platform_driver_register(&cel_dx010_lpc_drv); - - return 0; -} - -void cel_dx010_lpc_exit(void) -{ - platform_driver_unregister(&cel_dx010_lpc_drv); - platform_device_unregister(&cel_dx010_lpc_dev); -} - -module_init(cel_dx010_lpc_init); -module_exit(cel_dx010_lpc_exit); - -MODULE_AUTHOR("Abhisit Sangjan "); -MODULE_AUTHOR("Pariwat Leamsumran "); -MODULE_DESCRIPTION("Celestica SeaStone DX010 LPC Driver"); -MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/dx010_wdt.c b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/dx010_wdt.c deleted file mode 100644 index a386c065051a..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/dx010_wdt.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Watchdog driver for the Seastone DX010 - * - * Copyright (C) 2017 Celestica Corp. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#define DRIVER_NAME "dx010_wdt" - -#define RESET_CTRL 0x102 -#define WDT_MASK 0x04 -#define WDI_GPIO_DIR 0x504 -#define WDI_GPIO 0x508 - -static bool nowayout = WATCHDOG_NOWAYOUT; - -struct dx010_wdt_drvdata { - struct watchdog_device wdt; - struct mutex lock; -}; - -static struct resource dx010_wdt_resources[] = { - { - .flags = IORESOURCE_IO, - }, -}; - -static void dx010_wdt_dev_release( struct device * dev) -{ - return; -} - -static struct platform_device dx010_wdt_dev = { - .name = DRIVER_NAME, - .id = -1, - .num_resources = ARRAY_SIZE(dx010_wdt_resources), - .resource = dx010_wdt_resources, - .dev = { - .release = dx010_wdt_dev_release, - } -}; - -static int dx010_wdt_start(struct watchdog_device *wdt_dev) -{ - struct dx010_wdt_drvdata *drvdata = watchdog_get_drvdata(wdt_dev); - unsigned char reset_ctrl = 0x00; - unsigned long gpio ,dir; - - mutex_lock(&drvdata->lock); - - gpio = inl(WDI_GPIO); - gpio |= 1 << 15; - outl(gpio, WDI_GPIO); - - outl((inl(WDI_GPIO_DIR) & (~(1 << 15))), WDI_GPIO_DIR); - - reset_ctrl = inb(RESET_CTRL); - - gpio = inl(WDI_GPIO); - gpio &= ~(1 << 15); - outl_p( gpio, WDI_GPIO ); - - mdelay(10); - - gpio = inl(WDI_GPIO); - gpio |= (1 << 15); - outl_p( gpio, WDI_GPIO ); - - reset_ctrl |= WDT_MASK; - outb(reset_ctrl, RESET_CTRL); - - mutex_unlock(&drvdata->lock); - - return 0; -} - -static int dx010_wdt_stop(struct watchdog_device *wdt_dev) -{ - struct dx010_wdt_drvdata *drvdata = watchdog_get_drvdata(wdt_dev); - unsigned long reset_ctrl; - - mutex_lock(&drvdata->lock); - - reset_ctrl = inb(RESET_CTRL); - reset_ctrl &= ~WDT_MASK; - outb(reset_ctrl, RESET_CTRL); - - mutex_unlock(&drvdata->lock); - - return 0; -} - -static int dx010_wdt_ping(struct watchdog_device *wdt_dev) -{ - struct dx010_wdt_drvdata *drvdata = watchdog_get_drvdata(wdt_dev); - unsigned long gpio; - - mutex_lock(&drvdata->lock); - - gpio = inl(WDI_GPIO); - gpio &= ~(1 << 15); - outl_p( gpio, WDI_GPIO ); - - mdelay(10); - - gpio = inl(WDI_GPIO); - gpio |= (1 << 15); - outl_p( gpio, WDI_GPIO ); - - mutex_unlock(&drvdata->lock); - - return 0; -} - -static const struct watchdog_info dx010_wdt_info = { - .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, - .identity = "DX010 Watchdog", -}; - -static const struct watchdog_ops dx010_wdt_ops = { - .owner = THIS_MODULE, - .start = dx010_wdt_start, - .stop = dx010_wdt_stop, - .ping = dx010_wdt_ping, -}; - -static int dx010_wdt_probe(struct platform_device *pdev) -{ - struct dx010_wdt_drvdata *drvdata; - int ret; - - drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), - GFP_KERNEL); - if (!drvdata) { - ret = -ENOMEM; - goto err; - } - - mutex_init(&drvdata->lock); - - drvdata->wdt.info = &dx010_wdt_info; - drvdata->wdt.ops = &dx010_wdt_ops; - - watchdog_set_nowayout(&drvdata->wdt, nowayout); - watchdog_set_drvdata(&drvdata->wdt, drvdata); - - ret = watchdog_register_device(&drvdata->wdt); - if (ret != 0) { - dev_err(&pdev->dev, "watchdog_register_device() failed: %d\n", - ret); - goto err; - } - - platform_set_drvdata(pdev, drvdata); - -err: - return ret; -} - -static int dx010_wdt_remove(struct platform_device *pdev) -{ - struct dx010_wdt_drvdata *drvdata = platform_get_drvdata(pdev); - - watchdog_unregister_device(&drvdata->wdt); - - return 0; -} - -static struct platform_driver dx010_wdt_drv = { - .probe = dx010_wdt_probe, - .remove = dx010_wdt_remove, - .driver = { - .name = DRIVER_NAME, - }, -}; - -int dx010_wdt_init(void) -{ - platform_device_register(&dx010_wdt_dev); - platform_driver_register(&dx010_wdt_drv); - - return 0; -} - -void dx010_wdt_exit(void) -{ - platform_driver_unregister(&dx010_wdt_drv); - platform_device_unregister(&dx010_wdt_dev); -} - -module_init(dx010_wdt_init); -module_exit(dx010_wdt_exit); - -MODULE_AUTHOR("Abhisit Sangjan "); -MODULE_AUTHOR("Pariwat Leamsumran "); -MODULE_DESCRIPTION("Seastone DX010 Watchdog"); -MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:dx010-watchdog"); diff --git a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/emc2305.c b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/emc2305.c deleted file mode 100644 index b406a29fd9be..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/emc2305.c +++ /dev/null @@ -1,886 +0,0 @@ -/* - * emc2305.c - hwmon driver for SMSC EMC2305 fan controller - * (C) Copyright 2013 - * Reinhard Pfau, Guntermann & Drunck GmbH - * - * Based on emc2103 driver by SMSC. - * - * Datasheet available at: - * http://www.smsc.com/Downloads/SMSC/Downloads_Public/Data_Sheets/2305.pdf - * - * Also supports the EMC2303 fan controller which has the same functionality - * and register layout as EMC2305, but supports only up to 3 fans instead of 5. - * - * Also supports EMC2302 (up to 2 fans) and EMC2301 (1 fan) fan controller. - * - * 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. - */ - -/* - * TODO / IDEAS: - * - expose more of the configuration and features - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * Addresses scanned. - * Listed in the same order as they appear in the EMC2305, EMC2303 data sheets. - * - * Note: these are the I2C adresses which are possible for EMC2305 and EMC2303 - * chips. - * The EMC2302 supports only 0x2e (EMC2302-1) and 0x2f (EMC2302-2). - * The EMC2301 supports only 0x2f. - */ -static const unsigned short i2c_adresses[] = { - 0x2E, - 0x2F, - 0x2C, - 0x2D, - 0x4C, - 0x4D, - I2C_CLIENT_END -}; - -/* - * global registers - */ -enum { - REG_CONFIGURATION = 0x20, - REG_FAN_STATUS = 0x24, - REG_FAN_STALL_STATUS = 0x25, - REG_FAN_SPIN_STATUS = 0x26, - REG_DRIVE_FAIL_STATUS = 0x27, - REG_FAN_INTERRUPT_ENABLE = 0x29, - REG_PWM_POLARITY_CONFIG = 0x2a, - REG_PWM_OUTPUT_CONFIG = 0x2b, - REG_PWM_BASE_FREQ_1 = 0x2c, - REG_PWM_BASE_FREQ_2 = 0x2d, - REG_SOFTWARE_LOCK = 0xef, - REG_PRODUCT_FEATURES = 0xfc, - REG_PRODUCT_ID = 0xfd, - REG_MANUFACTURER_ID = 0xfe, - REG_REVISION = 0xff -}; - -/* - * fan specific registers - */ -enum { - REG_FAN_SETTING = 0x30, - REG_PWM_DIVIDE = 0x31, - REG_FAN_CONFIGURATION_1 = 0x32, - REG_FAN_CONFIGURATION_2 = 0x33, - REG_GAIN = 0x35, - REG_FAN_SPIN_UP_CONFIG = 0x36, - REG_FAN_MAX_STEP = 0x37, - REG_FAN_MINIMUM_DRIVE = 0x38, - REG_FAN_VALID_TACH_COUNT = 0x39, - REG_FAN_DRIVE_FAIL_BAND_LOW = 0x3a, - REG_FAN_DRIVE_FAIL_BAND_HIGH = 0x3b, - REG_TACH_TARGET_LOW = 0x3c, - REG_TACH_TARGET_HIGH = 0x3d, - REG_TACH_READ_HIGH = 0x3e, - REG_TACH_READ_LOW = 0x3f, -}; - -#define SEL_FAN(fan, reg) (reg + fan * 0x10) - -/* - * Factor by equations [2] and [3] from data sheet; valid for fans where the - * number of edges equals (poles * 2 + 1). - */ -#define FAN_RPM_FACTOR 3932160 - - -struct emc2305_fan_data { - bool enabled; - bool valid; - unsigned long last_updated; - bool rpm_control; - u8 multiplier; - u8 poles; - u16 target; - u16 tach; - u16 rpm_factor; - u8 pwm; -}; - -struct emc2305_data { - struct device *hwmon_dev; - struct mutex update_lock; - int fans; - struct emc2305_fan_data fan[5]; -}; - -static int read_u8_from_i2c(struct i2c_client *client, u8 i2c_reg, u8 *output) -{ - int status = i2c_smbus_read_byte_data(client, i2c_reg); - if (status < 0) { - dev_warn(&client->dev, "reg 0x%02x, err %d\n", - i2c_reg, status); - } else { - *output = status; - } - return status; -} - -static void read_fan_from_i2c(struct i2c_client *client, u16 *output, - u8 hi_addr, u8 lo_addr) -{ - u8 high_byte, lo_byte; - - if (read_u8_from_i2c(client, hi_addr, &high_byte) < 0) - return; - - if (read_u8_from_i2c(client, lo_addr, &lo_byte) < 0) - return; - - *output = ((u16)high_byte << 5) | (lo_byte >> 3); -} - -static void write_fan_target_to_i2c(struct i2c_client *client, int fan, - u16 new_target) -{ - const u8 lo_reg = SEL_FAN(fan, REG_TACH_TARGET_LOW); - const u8 hi_reg = SEL_FAN(fan, REG_TACH_TARGET_HIGH); - u8 high_byte = (new_target & 0x1fe0) >> 5; - u8 low_byte = (new_target & 0x001f) << 3; - i2c_smbus_write_byte_data(client, lo_reg, low_byte); - i2c_smbus_write_byte_data(client, hi_reg, high_byte); -} - -static void read_fan_config_from_i2c(struct i2c_client *client, int fan) - -{ - struct emc2305_data *data = i2c_get_clientdata(client); - u8 conf1; - - if (read_u8_from_i2c(client, SEL_FAN(fan, REG_FAN_CONFIGURATION_1), - &conf1) < 0) - return; - - data->fan[fan].rpm_control = (conf1 & 0x80) != 0; - data->fan[fan].multiplier = 1 << ((conf1 & 0x60) >> 5); - data->fan[fan].poles = ((conf1 & 0x18) >> 3) + 1; -} - -static void read_fan_setting(struct i2c_client *client, int fan) -{ - struct emc2305_data *data = i2c_get_clientdata(client); - u8 setting; - - if (read_u8_from_i2c(client, SEL_FAN(fan, REG_FAN_SETTING), - &setting) < 0) - return; - - data->fan[fan].pwm = setting; -} - -static void read_fan_data(struct i2c_client *client, int fan_idx) -{ - struct emc2305_data *data = i2c_get_clientdata(client); - - read_fan_from_i2c(client, &data->fan[fan_idx].target, - SEL_FAN(fan_idx, REG_TACH_TARGET_HIGH), - SEL_FAN(fan_idx, REG_TACH_TARGET_LOW)); - read_fan_from_i2c(client, &data->fan[fan_idx].tach, - SEL_FAN(fan_idx, REG_TACH_READ_HIGH), - SEL_FAN(fan_idx, REG_TACH_READ_LOW)); -} - -static struct emc2305_fan_data * -emc2305_update_fan(struct i2c_client *client, int fan_idx) -{ - struct emc2305_data *data = i2c_get_clientdata(client); - struct emc2305_fan_data *fan_data = &data->fan[fan_idx]; - - mutex_lock(&data->update_lock); - - if (time_after(jiffies, fan_data->last_updated + HZ + HZ / 2) - || !fan_data->valid) { - read_fan_config_from_i2c(client, fan_idx); - read_fan_data(client, fan_idx); - read_fan_setting(client, fan_idx); - fan_data->valid = true; - fan_data->last_updated = jiffies; - } - - mutex_unlock(&data->update_lock); - return fan_data; -} - -static struct emc2305_fan_data * -emc2305_update_device_fan(struct device *dev, struct device_attribute *da) -{ - struct i2c_client *client = to_i2c_client(dev); - int fan_idx = to_sensor_dev_attr(da)->index; - - return emc2305_update_fan(client, fan_idx); -} - -/* - * set/ config functions - */ - -/* - * Note: we also update the fan target here, because its value is - * determined in part by the fan clock divider. This follows the principle - * of least surprise; the user doesn't expect the fan target to change just - * because the divider changed. - */ -static int -emc2305_set_fan_div(struct i2c_client *client, int fan_idx, long new_div) -{ - struct emc2305_data *data = i2c_get_clientdata(client); - struct emc2305_fan_data *fan = emc2305_update_fan(client, fan_idx); - const u8 reg_conf1 = SEL_FAN(fan_idx, REG_FAN_CONFIGURATION_1); - int new_range_bits, old_div = 8 / fan->multiplier; - int status = 0; - - if (new_div == old_div) /* No change */ - return 0; - - switch (new_div) { - case 1: - new_range_bits = 3; - break; - case 2: - new_range_bits = 2; - break; - case 4: - new_range_bits = 1; - break; - case 8: - new_range_bits = 0; - break; - default: - return -EINVAL; - } - - mutex_lock(&data->update_lock); - - status = i2c_smbus_read_byte_data(client, reg_conf1); - if (status < 0) { - dev_dbg(&client->dev, "reg 0x%02x, err %d\n", - reg_conf1, status); - status = -EIO; - goto exit_unlock; - } - status &= 0x9F; - status |= (new_range_bits << 5); - status = i2c_smbus_write_byte_data(client, reg_conf1, status); - if (status < 0) { - status = -EIO; - goto exit_invalidate; - } - - fan->multiplier = 8 / new_div; - - /* update fan target if high byte is not disabled */ - if ((fan->target & 0x1fe0) != 0x1fe0) { - u16 new_target = (fan->target * old_div) / new_div; - fan->target = min_t(u16, new_target, 0x1fff); - write_fan_target_to_i2c(client, fan_idx, fan->target); - } - -exit_invalidate: - /* invalidate fan data to force re-read from hardware */ - fan->valid = false; -exit_unlock: - mutex_unlock(&data->update_lock); - return status; -} - -static int -emc2305_set_fan_target(struct i2c_client *client, int fan_idx, long rpm_target) -{ - struct emc2305_data *data = i2c_get_clientdata(client); - struct emc2305_fan_data *fan = emc2305_update_fan(client, fan_idx); - - /* - * Datasheet states 16000 as maximum RPM target - * (table 2.2 and section 4.3) - */ - if ((rpm_target < 0) || (rpm_target > 16000)) - return -EINVAL; - - mutex_lock(&data->update_lock); - - if (rpm_target == 0) - fan->target = 0x1fff; - else - fan->target = clamp_val( - (FAN_RPM_FACTOR * fan->multiplier) / rpm_target, - 0, 0x1fff); - - write_fan_target_to_i2c(client, fan_idx, fan->target); - - mutex_unlock(&data->update_lock); - return 0; -} - -static int -emc2305_set_pwm_enable(struct i2c_client *client, int fan_idx, long enable) -{ - struct emc2305_data *data = i2c_get_clientdata(client); - struct emc2305_fan_data *fan = emc2305_update_fan(client, fan_idx); - const u8 reg_fan_conf1 = SEL_FAN(fan_idx, REG_FAN_CONFIGURATION_1); - int status = 0; - u8 conf_reg; - - mutex_lock(&data->update_lock); - switch (enable) { - case 0: - fan->rpm_control = false; - break; - case 3: - fan->rpm_control = true; - break; - default: - status = -EINVAL; - goto exit_unlock; - } - - status = read_u8_from_i2c(client, reg_fan_conf1, &conf_reg); - if (status < 0) { - status = -EIO; - goto exit_unlock; - } - - if (fan->rpm_control) - conf_reg |= 0x80; - else - conf_reg &= ~0x80; - - status = i2c_smbus_write_byte_data(client, reg_fan_conf1, conf_reg); - if (status < 0) - status = -EIO; - -exit_unlock: - mutex_unlock(&data->update_lock); - return status; -} - -static int -emc2305_set_pwm(struct i2c_client *client, int fan_idx, long pwm) -{ - struct emc2305_data *data = i2c_get_clientdata(client); - struct emc2305_fan_data *fan = emc2305_update_fan(client, fan_idx); - const u8 reg_fan_setting = SEL_FAN(fan_idx, REG_FAN_SETTING); - int status = 0; - - /* - * Datasheet states 255 as maximum PWM - * (section 5.7) - */ - if ((pwm < 0) || (pwm > 255)) - return -EINVAL; - - fan->pwm = pwm; - - mutex_lock(&data->update_lock); - - status = i2c_smbus_write_byte_data(client, reg_fan_setting, fan->pwm); - - mutex_unlock(&data->update_lock); - return status; -} -/* - * sysfs callback functions - * - * Note: - * Naming of the funcs is modelled after the naming scheme described in - * Documentation/hwmon/sysfs-interface: - * - * For a sysfs file _ the functions are named like this: - * the show function: show__ - * the store function: set__ - * For read only (RO) attributes of course only the show func is required. - * - * This convention allows us to define the sysfs attributes by using macros. - */ - -static ssize_t -show_fan_input(struct device *dev, struct device_attribute *da, char *buf) -{ - struct emc2305_fan_data *fan = emc2305_update_device_fan(dev, da); - int rpm = 0; - if (fan->tach != 0) - rpm = (FAN_RPM_FACTOR * fan->multiplier) / fan->tach; - return sprintf(buf, "%d\n", rpm); -} - -static ssize_t -show_fan_fault(struct device *dev, struct device_attribute *da, char *buf) -{ - struct emc2305_fan_data *fan = emc2305_update_device_fan(dev, da); - bool fault = ((fan->tach & 0x1fe0) == 0x1fe0); - return sprintf(buf, "%d\n", fault ? 1 : 0); -} - -static ssize_t -show_fan_div(struct device *dev, struct device_attribute *da, char *buf) -{ - struct emc2305_fan_data *fan = emc2305_update_device_fan(dev, da); - int fan_div = 8 / fan->multiplier; - return sprintf(buf, "%d\n", fan_div); -} - -static ssize_t -show_fan_alarm(struct device *dev, struct device_attribute *da, char *buf) -{ - struct emc2305_fan_data *fan = emc2305_update_device_fan(dev, da); - bool fault = ((fan->tach & 0x1fe0) == 0x1fe0); - return sprintf(buf, "%d\n", fault ? 1 : 0); -} - -static ssize_t -set_fan_div(struct device *dev, struct device_attribute *da, - const char *buf, size_t count) -{ - struct i2c_client *client = to_i2c_client(dev); - int fan_idx = to_sensor_dev_attr(da)->index; - long new_div; - int status; - - status = kstrtol(buf, 10, &new_div); - if (status < 0) - return -EINVAL; - - status = emc2305_set_fan_div(client, fan_idx, new_div); - if (status < 0) - return status; - - return count; -} - -static ssize_t -show_fan_target(struct device *dev, struct device_attribute *da, char *buf) -{ - struct emc2305_fan_data *fan = emc2305_update_device_fan(dev, da); - int rpm = 0; - - /* high byte of 0xff indicates disabled so return 0 */ - if ((fan->target != 0) && ((fan->target & 0x1fe0) != 0x1fe0)) - rpm = (FAN_RPM_FACTOR * fan->multiplier) - / fan->target; - - return sprintf(buf, "%d\n", rpm); -} - -static ssize_t set_fan_target(struct device *dev, struct device_attribute *da, - const char *buf, size_t count) -{ - struct i2c_client *client = to_i2c_client(dev); - int fan_idx = to_sensor_dev_attr(da)->index; - long rpm_target; - int status; - - status = kstrtol(buf, 10, &rpm_target); - if (status < 0) - return -EINVAL; - - status = emc2305_set_fan_target(client, fan_idx, rpm_target); - if (status < 0) - return status; - - return count; -} - -static ssize_t -show_pwm_enable(struct device *dev, struct device_attribute *da, char *buf) -{ - struct emc2305_fan_data *fan = emc2305_update_device_fan(dev, da); - return sprintf(buf, "%d\n", fan->rpm_control ? 3 : 0); -} - -static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *da, - const char *buf, size_t count) -{ - struct i2c_client *client = to_i2c_client(dev); - int fan_idx = to_sensor_dev_attr(da)->index; - long new_value; - int status; - - status = kstrtol(buf, 10, &new_value); - if (status < 0) - return -EINVAL; - status = emc2305_set_pwm_enable(client, fan_idx, new_value); - return count; -} - -static ssize_t show_pwm(struct device *dev, struct device_attribute *da, - char *buf) -{ - struct emc2305_fan_data *fan = emc2305_update_device_fan(dev, da); - return sprintf(buf, "%d\n", fan->pwm); -} - -static ssize_t set_pwm(struct device *dev, struct device_attribute *da, - const char *buf, size_t count) -{ - struct i2c_client *client = to_i2c_client(dev); - int fan_idx = to_sensor_dev_attr(da)->index; - unsigned long val; - int ret; - int status; - - ret = kstrtoul(buf, 10, &val); - if (ret) - return ret; - if (val > 255) - return -EINVAL; - - status = emc2305_set_pwm(client, fan_idx, val); - return count; -} - -/* define a read only attribute */ -#define EMC2305_ATTR_RO(_type, _item, _num) \ - SENSOR_ATTR(_type ## _num ## _ ## _item, S_IRUGO, \ - show_## _type ## _ ## _item, NULL, _num - 1) - -/* define a read/write attribute */ -#define EMC2305_ATTR_RW(_type, _item, _num) \ - SENSOR_ATTR(_type ## _num ## _ ## _item, S_IRUGO | S_IWUSR, \ - show_## _type ##_ ## _item, \ - set_## _type ## _ ## _item, _num - 1) - -/* - * TODO: Ugly hack, but temporary as this whole logic needs - * to be rewritten as per standard HWMON sysfs registration - */ - -/* define a read/write attribute */ -#define EMC2305_ATTR_RW2(_type, _num) \ - SENSOR_ATTR(_type ## _num, S_IRUGO | S_IWUSR, \ - show_## _type, set_## _type, _num - 1) - -/* defines the attributes for a single fan */ -#define EMC2305_DEFINE_FAN_ATTRS(_num) \ - static const \ - struct sensor_device_attribute emc2305_attr_fan ## _num[] = { \ - EMC2305_ATTR_RO(fan, input, _num), \ - EMC2305_ATTR_RO(fan, fault, _num), \ - EMC2305_ATTR_RW(fan, div, _num), \ - EMC2305_ATTR_RO(fan, alarm, _num), \ - EMC2305_ATTR_RW(fan, target, _num), \ - EMC2305_ATTR_RW(pwm, enable, _num), \ - EMC2305_ATTR_RW2(pwm, _num) \ - } - -#define EMC2305_NUM_FAN_ATTRS ARRAY_SIZE(emc2305_attr_fan1) - -/* common attributes for EMC2303 and EMC2305 */ -static const struct sensor_device_attribute emc2305_attr_common[] = { -}; - -/* fan attributes for the single fans */ -EMC2305_DEFINE_FAN_ATTRS(1); -EMC2305_DEFINE_FAN_ATTRS(2); -EMC2305_DEFINE_FAN_ATTRS(3); -EMC2305_DEFINE_FAN_ATTRS(4); -EMC2305_DEFINE_FAN_ATTRS(5); -EMC2305_DEFINE_FAN_ATTRS(6); - -/* fan attributes */ -static const struct sensor_device_attribute *emc2305_fan_attrs[] = { - emc2305_attr_fan1, - emc2305_attr_fan2, - emc2305_attr_fan3, - emc2305_attr_fan4, - emc2305_attr_fan5, -}; - -/* - * driver interface - */ - -static int emc2305_remove(struct i2c_client *client) -{ - struct emc2305_data *data = i2c_get_clientdata(client); - int fan_idx, i; - - hwmon_device_unregister(data->hwmon_dev); - - for (fan_idx = 0; fan_idx < data->fans; ++fan_idx) - for (i = 0; i < EMC2305_NUM_FAN_ATTRS; ++i) - device_remove_file( - &client->dev, - &emc2305_fan_attrs[fan_idx][i].dev_attr); - - for (i = 0; i < ARRAY_SIZE(emc2305_attr_common); ++i) - device_remove_file(&client->dev, - &emc2305_attr_common[i].dev_attr); - - kfree(data); - return 0; -} - - -#ifdef CONFIG_OF -/* - * device tree support - */ - -struct of_fan_attribute { - const char *name; - int (*set)(struct i2c_client*, int, long); -}; - -struct of_fan_attribute of_fan_attributes[] = { - {"fan-div", emc2305_set_fan_div}, - {"fan-target", emc2305_set_fan_target}, - {"pwm-enable", emc2305_set_pwm_enable}, - {NULL, NULL} -}; - -static int emc2305_config_of(struct i2c_client *client) -{ - struct emc2305_data *data = i2c_get_clientdata(client); - struct device_node *node; - unsigned int fan_idx; - - if (!client->dev.of_node) - return -EINVAL; - if (!of_get_next_child(client->dev.of_node, NULL)) - return 0; - - for (fan_idx = 0; fan_idx < data->fans; ++fan_idx) - data->fan[fan_idx].enabled = false; - - for_each_child_of_node(client->dev.of_node, node) { - const __be32 *property; - int len; - struct of_fan_attribute *attr; - - property = of_get_property(node, "reg", &len); - if (!property || len != sizeof(int)) { - dev_err(&client->dev, "invalid reg on %s\n", - node->full_name); - continue; - } - - fan_idx = be32_to_cpup(property); - if (fan_idx >= data->fans) { - dev_err(&client->dev, - "invalid fan index %d on %s\n", - fan_idx, node->full_name); - continue; - } - - data->fan[fan_idx].enabled = true; - - for (attr = of_fan_attributes; attr->name; ++attr) { - int status = 0; - long value; - property = of_get_property(node, attr->name, &len); - if (!property) - continue; - if (len != sizeof(int)) { - dev_err(&client->dev, "invalid %s on %s\n", - attr->name, node->full_name); - continue; - } - value = be32_to_cpup(property); - status = attr->set(client, fan_idx, value); - if (status == -EINVAL) { - dev_err(&client->dev, - "invalid value for %s on %s\n", - attr->name, node->full_name); - } - } - } - - return 0; -} - -#endif - -static void emc2305_get_config(struct i2c_client *client) -{ - int i; - struct emc2305_data *data = i2c_get_clientdata(client); - - for (i = 0; i < data->fans; ++i) { - data->fan[i].enabled = true; - emc2305_update_fan(client, i); - } - -#ifdef CONFIG_OF - emc2305_config_of(client); -#endif - -} - -static int -emc2305_probe(struct i2c_client *client, const struct i2c_device_id *id) -{ - struct emc2305_data *data; - int status; - int i; - int fan_idx; - - if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - return -EIO; - - data = kzalloc(sizeof(struct emc2305_data), GFP_KERNEL); - if (!data) - return -ENOMEM; - - i2c_set_clientdata(client, data); - mutex_init(&data->update_lock); - - status = i2c_smbus_read_byte_data(client, REG_PRODUCT_ID); - switch (status) { - case 0x34: /* EMC2305 */ - data->fans = 5; - break; - case 0x35: /* EMC2303 */ - data->fans = 3; - break; - case 0x36: /* EMC2302 */ - data->fans = 2; - break; - case 0x37: /* EMC2301 */ - data->fans = 1; - break; - default: - if (status >= 0) - status = -EINVAL; - goto exit_free; - } - - emc2305_get_config(client); - - for (i = 0; i < ARRAY_SIZE(emc2305_attr_common); ++i) { - status = device_create_file(&client->dev, - &emc2305_attr_common[i].dev_attr); - if (status) - goto exit_remove; - } - for (fan_idx = 0; fan_idx < data->fans; ++fan_idx) - for (i = 0; i < EMC2305_NUM_FAN_ATTRS; ++i) { - if (!data->fan[fan_idx].enabled) - continue; - status = device_create_file( - &client->dev, - &emc2305_fan_attrs[fan_idx][i].dev_attr); - if (status) - goto exit_remove_fans; - } - - data->hwmon_dev = hwmon_device_register(&client->dev); - if (IS_ERR(data->hwmon_dev)) { - status = PTR_ERR(data->hwmon_dev); - goto exit_remove_fans; - } - - dev_info(&client->dev, "%s: sensor '%s'\n", - dev_name(data->hwmon_dev), client->name); - - return 0; - -exit_remove_fans: - for (fan_idx = 0; fan_idx < data->fans; ++fan_idx) - for (i = 0; i < EMC2305_NUM_FAN_ATTRS; ++i) - device_remove_file( - &client->dev, - &emc2305_fan_attrs[fan_idx][i].dev_attr); - -exit_remove: - for (i = 0; i < ARRAY_SIZE(emc2305_attr_common); ++i) - device_remove_file(&client->dev, - &emc2305_attr_common[i].dev_attr); -exit_free: - kfree(data); - return status; -} - -static const struct i2c_device_id emc2305_id[] = { - { "emc2305", 0 }, - { "emc2303", 0 }, - { "emc2302", 0 }, - { "emc2301", 0 }, - { } -}; -MODULE_DEVICE_TABLE(i2c, emc2305_id); - -/* Return 0 if detection is successful, -ENODEV otherwise */ -static int -emc2305_detect(struct i2c_client *new_client, struct i2c_board_info *info) -{ - struct i2c_adapter *adapter = new_client->adapter; - int manufacturer, product; - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - return -ENODEV; - - manufacturer = - i2c_smbus_read_byte_data(new_client, REG_MANUFACTURER_ID); - if (manufacturer != 0x5D) - return -ENODEV; - - product = i2c_smbus_read_byte_data(new_client, REG_PRODUCT_ID); - - switch (product) { - case 0x34: - strlcpy(info->type, "emc2305", I2C_NAME_SIZE); - break; - case 0x35: - strlcpy(info->type, "emc2303", I2C_NAME_SIZE); - break; - case 0x36: - strlcpy(info->type, "emc2302", I2C_NAME_SIZE); - break; - case 0x37: - strlcpy(info->type, "emc2301", I2C_NAME_SIZE); - break; - default: - return -ENODEV; - } - - return 0; -} - -static struct i2c_driver emc2305_driver = { - .class = I2C_CLASS_HWMON, - .driver = { - .name = "emc2305", - }, - .probe = emc2305_probe, - .remove = emc2305_remove, - .id_table = emc2305_id, -/* - .detect = emc2305_detect, - .address_list = i2c_adresses, -*/ -}; - -module_i2c_driver(emc2305_driver); - -MODULE_AUTHOR("Reinhard Pfau "); -MODULE_DESCRIPTION("SMSC EMC2305 hwmon driver"); -MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/leds-dx010.c b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/leds-dx010.c deleted file mode 100644 index fac8322f06b0..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/leds-dx010.c +++ /dev/null @@ -1,289 +0,0 @@ -/* - * leds-dx010-status.c - Driver for Seastone DX010 front panel LEDs - * - * Copyright (C) 2017 Celestica Corp. - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include - -#define DRIVER_NAME "leds_dx010" -#define FRONT_LED_STAT 0x303 - -static int dx010_led_blink_stat(struct led_classdev *led_cdev, - unsigned long *delay_on, - unsigned long *delay_off) -{ - unsigned char led; - - if (!(*delay_on == 0 && *delay_off == 0) && - !(*delay_on == 250 && *delay_off == 250) && - !(*delay_on == 500 && *delay_off == 500)) - return -EINVAL; - - led = inb(FRONT_LED_STAT); - led &= 0xfc; - - if ((*delay_on == 250) && (*delay_off == 250)) - led |= 0x02; - else if ((*delay_on == 500) && (*delay_off == 500)) - led |= 0x01; - - outb(led, FRONT_LED_STAT); - - return 0; -} - -static ssize_t dx010_led_blink_show_stat(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct led_classdev *leddev = dev_get_drvdata(dev); - unsigned char led; - const char *msg; - - led = inb(FRONT_LED_STAT); - led &= 0x03; - - switch (led) - { - case 0: - msg = "No blinking, turn on"; - break; - case 1: - msg = "1 Hz is blinking"; - break; - case 2: - msg = "4 Hz is blinking"; - break; - case 3: - msg = "No blinking, turn off"; - break; - default: - msg = "Unknown error"; - break; - } - - return sprintf(buf, "%s\n", msg); -} - -static ssize_t dx010_led_blink_store_stat(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t size) -{ - int ret; - struct led_classdev *leddev = dev_get_drvdata(dev); - unsigned long blink_state; - unsigned char led; - - ret = kstrtoul(buf, 10, &blink_state); - if (ret) - return ret; - - led = inb(FRONT_LED_STAT); - led &= 0xfc; - - switch (blink_state) - { - case 0: - led |= 0x03; - break; - case 1: - break; - case 250: - led |= 0x02; - break; - case 500: - led |= 0x01; - break; - default: - return -EINVAL; - break; - } - - outb(led, FRONT_LED_STAT); - - return size; -} -static DEVICE_ATTR(blink, 0644, dx010_led_blink_show_stat, dx010_led_blink_store_stat); - -static void dx010_led_brightness_set_stat(struct led_classdev *led_cdev, - enum led_brightness brightness) -{ - unsigned char led; - - led = inb(FRONT_LED_STAT); - led &= 0xfc; - - if (!brightness) - led |= 0x03; - - outb( led, FRONT_LED_STAT); -} - -enum led_brightness dx010_led_brightness_get_p2(struct led_classdev *led_cdev) -{ - unsigned char led; - - led = inb(FRONT_LED_STAT); - - return (led & 0x08) ? LED_OFF : LED_FULL; -} - -static void dx010_led_brightness_set_p2(struct led_classdev *led_cdev, - enum led_brightness brightness) -{ - unsigned char led; - - led = inb(FRONT_LED_STAT); - led &= 0xf7; - - if (!brightness) - led |= 0x08; - - outb( led, FRONT_LED_STAT); -} - -enum led_brightness dx010_led_brightness_get_p1(struct led_classdev *led_cdev) -{ - unsigned char led; - - led = inb(FRONT_LED_STAT); - - return (led & 0x04) ? LED_OFF : LED_FULL; -} - -static void dx010_led_brightness_set_p1(struct led_classdev *led_cdev, - enum led_brightness brightness) -{ - unsigned char led; - - led = inb(FRONT_LED_STAT); - led &= 0xfb; - - if (!brightness) - led |= 0x04; - - outb( led, FRONT_LED_STAT); -} - -static struct led_classdev dx010_leds[] = { - { - .name = "dx010:green:p-1", - .brightness = LED_OFF, - .max_brightness = 1, - .brightness_get = dx010_led_brightness_get_p1, - .brightness_set = dx010_led_brightness_set_p1, - }, - { - .name = "dx010:green:p-2", - .brightness = LED_OFF, - .max_brightness = 1, - .brightness_get = dx010_led_brightness_get_p2, - .brightness_set = dx010_led_brightness_set_p2, - }, - { - .name = "dx010:green:stat", - .brightness = LED_OFF, - .max_brightness = 1, - .brightness_set = dx010_led_brightness_set_stat, - .blink_set = dx010_led_blink_stat, - .flags = LED_CORE_SUSPENDRESUME, - }, -}; - -static struct resource dx010_led_resources[] = { - { - .flags = IORESOURCE_IO, - }, -}; - -static void dx010_led_dev_release( struct device * dev) -{ - return; -} - -static struct platform_device dx010_lpc_dev = { - .name = DRIVER_NAME, - .id = -1, - .num_resources = ARRAY_SIZE(dx010_led_resources), - .resource = dx010_led_resources, - .dev = { - .release = dx010_led_dev_release, - } -}; - -static int dx010_led_drv_probe(struct platform_device *pdev) -{ - int i, ret; - - for (i = 0; i < ARRAY_SIZE(dx010_leds); i++) { - ret = led_classdev_register(&pdev->dev, &dx010_leds[i]); - if (ret < 0) - goto exit; - } - - ret = device_create_file(&pdev->dev, &dev_attr_blink); - if (ret) - { - for (i = 0; i < ARRAY_SIZE(dx010_leds); i++) - led_classdev_unregister(&dx010_leds[i]); - } -exit: - return ret; -} - -static int dx010_led_drv_remove(struct platform_device *pdev) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(dx010_leds); i++) - led_classdev_unregister(&dx010_leds[i]); - - device_remove_file(&pdev->dev, &dev_attr_blink); - - return 0; -} - -static struct platform_driver dx010_led_drv = { - .probe = dx010_led_drv_probe, - .remove = __exit_p(dx010_led_drv_remove), - .driver = { - .name = DRIVER_NAME, - }, -}; - -int dx010_led_init(void) -{ - platform_device_register(&dx010_lpc_dev); - platform_driver_register(&dx010_led_drv); - - return 0; -} - -void dx010_led_exit(void) -{ - platform_driver_unregister(&dx010_led_drv); - platform_device_unregister(&dx010_lpc_dev); -} - -module_init(dx010_led_init); -module_exit(dx010_led_exit); - -MODULE_AUTHOR("Abhisit Sangjan "); -MODULE_DESCRIPTION("Celestica SeaStone DX010 LEDs Front Panel Status Driver"); -MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/mc24lc64t.c b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/mc24lc64t.c deleted file mode 100644 index a391056d09a7..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/mc24lc64t.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * mc24lc64t.c - driver for Microchip 24LC64T - * - * Copyright (C) 2017 Celestica Corp. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -struct mc24lc64t_data { - struct i2c_client *fake_client; - struct mutex update_lock; -}; - -static ssize_t mc24lc64t_read(struct file *filp, struct kobject *kobj, - struct bin_attribute *bin_attr, - char *buf, loff_t off, size_t count) -{ - struct i2c_client *client = kobj_to_i2c_client(kobj); - struct mc24lc64t_data *drvdata = i2c_get_clientdata(client); - unsigned long timeout, read_time, i = 0; - int status; - - mutex_lock(&drvdata->update_lock); - - if (i2c_smbus_write_byte_data(client, off>>8, off)) - { - status = -EIO; - goto exit; - } - - msleep(1); - -begin: - - if (i < count) - { - timeout = jiffies + msecs_to_jiffies(25); /* 25 mS timeout*/ - do { - read_time = jiffies; - - status = i2c_smbus_read_byte(client); - if (status >= 0) - { - buf[i++] = status; - goto begin; - } - } while (time_before(read_time, timeout)); - - status = -ETIMEDOUT; - goto exit; - } - - status = count; - -exit: - mutex_unlock(&drvdata->update_lock); - - return status; -} - -static struct bin_attribute mc24lc64t_bit_attr = { - .attr = { - .name = "eeprom", - .mode = S_IRUGO, - }, - .size = 65536, - .read = mc24lc64t_read, -}; - -static int mc24lc64t_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - struct i2c_adapter *adapter = client->adapter; - struct mc24lc64t_data *drvdata; - int err; - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WRITE_BYTE_DATA - | I2C_FUNC_SMBUS_READ_BYTE)) - return -EPFNOSUPPORT; - - if (!(drvdata = devm_kzalloc(&client->dev, - sizeof(struct mc24lc64t_data), GFP_KERNEL))) - return -ENOMEM; - - drvdata->fake_client = i2c_new_dummy(client->adapter, client->addr + 1); - if (!drvdata->fake_client) - return -ENOMEM; - - i2c_set_clientdata(client, drvdata); - mutex_init(&drvdata->update_lock); - - err = sysfs_create_bin_file(&client->dev.kobj, &mc24lc64t_bit_attr); - if (err) - i2c_unregister_device(drvdata->fake_client); - - return err; -} - -static int mc24lc64t_remove(struct i2c_client *client) -{ - struct mc24lc64t_data *drvdata = i2c_get_clientdata(client); - - i2c_unregister_device(drvdata->fake_client); - - sysfs_remove_bin_file(&client->dev.kobj, &mc24lc64t_bit_attr); - - return 0; -} - -static const struct i2c_device_id mc24lc64t_id[] = { - { "24lc64t", 0 }, - { } -}; -MODULE_DEVICE_TABLE(i2c, mc24lc64t_id); - -static struct i2c_driver mc24lc64t_driver = { - .driver = { - .name = "mc24lc64t", - .owner = THIS_MODULE, - }, - .probe = mc24lc64t_probe, - .remove = mc24lc64t_remove, - .id_table = mc24lc64t_id, -}; - -module_i2c_driver(mc24lc64t_driver); - -MODULE_AUTHOR("Abhisit Sangjan "); -MODULE_DESCRIPTION("Microchip 24LC64T Driver"); -MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-cel/dx010/scripts/dx010_check_qsfp.sh b/platform/broadcom/sonic-platform-modules-cel/dx010/scripts/dx010_check_qsfp.sh deleted file mode 100644 index 938b07952e0d..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/dx010/scripts/dx010_check_qsfp.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -#Usage: -# TBD - -echo "Do we need to check qsfp?" - diff --git a/platform/broadcom/sonic-platform-modules-cel/dx010/systemd/platform-modules-dx010.service b/platform/broadcom/sonic-platform-modules-cel/dx010/systemd/platform-modules-dx010.service deleted file mode 100644 index 32827dcf0dec..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/dx010/systemd/platform-modules-dx010.service +++ /dev/null @@ -1,14 +0,0 @@ - -[Unit] -Description=Celestica Seastone dx010 platform modules -After=local-fs.target -Before=pmon.service - -[Service] -Type=oneshot -ExecStart=-/etc/init.d/platform-modules-dx010 start -ExecStop=-/etc/init.d/platform-modules-dx010 stop -RemainAfterExit=yes - -[Install] -WantedBy=multi-user.target \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-cel/haliburton/cfg/haliburton-modules.conf b/platform/broadcom/sonic-platform-modules-cel/haliburton/cfg/haliburton-modules.conf deleted file mode 100644 index 66f002a5fc94..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/haliburton/cfg/haliburton-modules.conf +++ /dev/null @@ -1,15 +0,0 @@ -# /etc/modules: kernel modules to load at boot time. -# -# This file contains the names of kernel modules that should be loaded -# at boot time, one per line. Lines beginning with "#" are ignored. - -i2c-i801 -i2c-isch -i2c-ismt -i2c-dev -i2c-mux -i2c-smbus - -i2c-mux-gpio -i2c-mux-pca954x - diff --git a/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/Makefile b/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/Makefile deleted file mode 100644 index 58e2b0bf2d7a..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/Makefile +++ /dev/null @@ -1 +0,0 @@ -obj-m := mc24lc64t.o emc2305.o smc.o diff --git a/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/emc2305.c b/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/emc2305.c deleted file mode 100644 index f08033e080ce..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/emc2305.c +++ /dev/null @@ -1,877 +0,0 @@ -/* - * emc2305.c - hwmon driver for SMSC EMC2305 fan controller - * (C) Copyright 2013 - * Reinhard Pfau, Guntermann & Drunck GmbH - * - * Based on emc2103 driver by SMSC. - * - * Datasheet available at: - * http://www.smsc.com/Downloads/SMSC/Downloads_Public/Data_Sheets/2305.pdf - * - * Also supports the EMC2303 fan controller which has the same functionality - * and register layout as EMC2305, but supports only up to 3 fans instead of 5. - * - * Also supports EMC2302 (up to 2 fans) and EMC2301 (1 fan) fan controller. - * - * 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. - */ - -/* - * TODO / IDEAS: - * - expose more of the configuration and features - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * Addresses scanned. - * Listed in the same order as they appear in the EMC2305, EMC2303 data sheets. - * - * Note: these are the I2C adresses which are possible for EMC2305 and EMC2303 - * chips. - * The EMC2302 supports only 0x2e (EMC2302-1) and 0x2f (EMC2302-2). - * The EMC2301 supports only 0x2f. - */ -static const unsigned short i2c_adresses[] = { - 0x2E, - 0x2F, - 0x2C, - 0x2D, - 0x4C, - 0x4D, - I2C_CLIENT_END -}; - -/* - * global registers - */ -enum { - REG_CONFIGURATION = 0x20, - REG_FAN_STATUS = 0x24, - REG_FAN_STALL_STATUS = 0x25, - REG_FAN_SPIN_STATUS = 0x26, - REG_DRIVE_FAIL_STATUS = 0x27, - REG_FAN_INTERRUPT_ENABLE = 0x29, - REG_PWM_POLARITY_CONFIG = 0x2a, - REG_PWM_OUTPUT_CONFIG = 0x2b, - REG_PWM_BASE_FREQ_1 = 0x2c, - REG_PWM_BASE_FREQ_2 = 0x2d, - REG_SOFTWARE_LOCK = 0xef, - REG_PRODUCT_FEATURES = 0xfc, - REG_PRODUCT_ID = 0xfd, - REG_MANUFACTURER_ID = 0xfe, - REG_REVISION = 0xff -}; - -/* - * fan specific registers - */ -enum { - REG_FAN_SETTING = 0x30, - REG_PWM_DIVIDE = 0x31, - REG_FAN_CONFIGURATION_1 = 0x32, - REG_FAN_CONFIGURATION_2 = 0x33, - REG_GAIN = 0x35, - REG_FAN_SPIN_UP_CONFIG = 0x36, - REG_FAN_MAX_STEP = 0x37, - REG_FAN_MINIMUM_DRIVE = 0x38, - REG_FAN_VALID_TACH_COUNT = 0x39, - REG_FAN_DRIVE_FAIL_BAND_LOW = 0x3a, - REG_FAN_DRIVE_FAIL_BAND_HIGH = 0x3b, - REG_TACH_TARGET_LOW = 0x3c, - REG_TACH_TARGET_HIGH = 0x3d, - REG_TACH_READ_HIGH = 0x3e, - REG_TACH_READ_LOW = 0x3f, -}; - -#define SEL_FAN(fan, reg) (reg + fan * 0x10) - -/* - * Factor by equations [2] and [3] from data sheet; valid for fans where the - * number of edges equals (poles * 2 + 1). - */ -#define FAN_RPM_FACTOR 3932160 - - -struct emc2305_fan_data { - bool enabled; - bool valid; - unsigned long last_updated; - bool rpm_control; - u8 multiplier; - u8 poles; - u16 target; - u16 tach; - u16 rpm_factor; - u8 pwm; -}; - -struct emc2305_data { - struct device *hwmon_dev; - struct mutex update_lock; - int fans; - struct emc2305_fan_data fan[5]; -}; - -static int read_u8_from_i2c(struct i2c_client *client, u8 i2c_reg, u8 *output) -{ - int status = i2c_smbus_read_byte_data(client, i2c_reg); - if (status < 0) { - dev_warn(&client->dev, "reg 0x%02x, err %d\n", - i2c_reg, status); - } else { - *output = status; - } - return status; -} - -static void read_fan_from_i2c(struct i2c_client *client, u16 *output, - u8 hi_addr, u8 lo_addr) -{ - u8 high_byte, lo_byte; - - if (read_u8_from_i2c(client, hi_addr, &high_byte) < 0) - return; - - if (read_u8_from_i2c(client, lo_addr, &lo_byte) < 0) - return; - - *output = ((u16)high_byte << 5) | (lo_byte >> 3); -} - -static void write_fan_target_to_i2c(struct i2c_client *client, int fan, - u16 new_target) -{ - const u8 lo_reg = SEL_FAN(fan, REG_TACH_TARGET_LOW); - const u8 hi_reg = SEL_FAN(fan, REG_TACH_TARGET_HIGH); - u8 high_byte = (new_target & 0x1fe0) >> 5; - u8 low_byte = (new_target & 0x001f) << 3; - i2c_smbus_write_byte_data(client, lo_reg, low_byte); - i2c_smbus_write_byte_data(client, hi_reg, high_byte); -} - -static void read_fan_config_from_i2c(struct i2c_client *client, int fan) - -{ - struct emc2305_data *data = i2c_get_clientdata(client); - u8 conf1; - - if (read_u8_from_i2c(client, SEL_FAN(fan, REG_FAN_CONFIGURATION_1), - &conf1) < 0) - return; - - data->fan[fan].rpm_control = (conf1 & 0x80) != 0; - data->fan[fan].multiplier = 1 << ((conf1 & 0x60) >> 5); - data->fan[fan].poles = ((conf1 & 0x18) >> 3) + 1; -} - -static void read_fan_setting(struct i2c_client *client, int fan) -{ - struct emc2305_data *data = i2c_get_clientdata(client); - u8 setting; - - if (read_u8_from_i2c(client, SEL_FAN(fan, REG_FAN_SETTING), - &setting) < 0) - return; - - data->fan[fan].pwm = setting; -} - -static void read_fan_data(struct i2c_client *client, int fan_idx) -{ - struct emc2305_data *data = i2c_get_clientdata(client); - - read_fan_from_i2c(client, &data->fan[fan_idx].target, - SEL_FAN(fan_idx, REG_TACH_TARGET_HIGH), - SEL_FAN(fan_idx, REG_TACH_TARGET_LOW)); - read_fan_from_i2c(client, &data->fan[fan_idx].tach, - SEL_FAN(fan_idx, REG_TACH_READ_HIGH), - SEL_FAN(fan_idx, REG_TACH_READ_LOW)); -} - -static struct emc2305_fan_data * -emc2305_update_fan(struct i2c_client *client, int fan_idx) -{ - struct emc2305_data *data = i2c_get_clientdata(client); - struct emc2305_fan_data *fan_data = &data->fan[fan_idx]; - - mutex_lock(&data->update_lock); - - if (time_after(jiffies, fan_data->last_updated + HZ + HZ / 2) - || !fan_data->valid) { - read_fan_config_from_i2c(client, fan_idx); - read_fan_data(client, fan_idx); - read_fan_setting(client, fan_idx); - fan_data->valid = true; - fan_data->last_updated = jiffies; - } - - mutex_unlock(&data->update_lock); - return fan_data; -} - -static struct emc2305_fan_data * -emc2305_update_device_fan(struct device *dev, struct device_attribute *da) -{ - struct i2c_client *client = to_i2c_client(dev); - int fan_idx = to_sensor_dev_attr(da)->index; - - return emc2305_update_fan(client, fan_idx); -} - -/* - * set/ config functions - */ - -/* - * Note: we also update the fan target here, because its value is - * determined in part by the fan clock divider. This follows the principle - * of least surprise; the user doesn't expect the fan target to change just - * because the divider changed. - */ -static int -emc2305_set_fan_div(struct i2c_client *client, int fan_idx, long new_div) -{ - struct emc2305_data *data = i2c_get_clientdata(client); - struct emc2305_fan_data *fan = emc2305_update_fan(client, fan_idx); - const u8 reg_conf1 = SEL_FAN(fan_idx, REG_FAN_CONFIGURATION_1); - int new_range_bits, old_div = 8 / fan->multiplier; - int status = 0; - - if (new_div == old_div) /* No change */ - return 0; - - switch (new_div) { - case 1: - new_range_bits = 3; - break; - case 2: - new_range_bits = 2; - break; - case 4: - new_range_bits = 1; - break; - case 8: - new_range_bits = 0; - break; - default: - return -EINVAL; - } - - mutex_lock(&data->update_lock); - - status = i2c_smbus_read_byte_data(client, reg_conf1); - if (status < 0) { - dev_dbg(&client->dev, "reg 0x%02x, err %d\n", - reg_conf1, status); - status = -EIO; - goto exit_unlock; - } - status &= 0x9F; - status |= (new_range_bits << 5); - status = i2c_smbus_write_byte_data(client, reg_conf1, status); - if (status < 0) { - status = -EIO; - goto exit_invalidate; - } - - fan->multiplier = 8 / new_div; - - /* update fan target if high byte is not disabled */ - if ((fan->target & 0x1fe0) != 0x1fe0) { - u16 new_target = (fan->target * old_div) / new_div; - fan->target = min_t(u16, new_target, 0x1fff); - write_fan_target_to_i2c(client, fan_idx, fan->target); - } - -exit_invalidate: - /* invalidate fan data to force re-read from hardware */ - fan->valid = false; -exit_unlock: - mutex_unlock(&data->update_lock); - return status; -} - -static int -emc2305_set_fan_target(struct i2c_client *client, int fan_idx, long rpm_target) -{ - struct emc2305_data *data = i2c_get_clientdata(client); - struct emc2305_fan_data *fan = emc2305_update_fan(client, fan_idx); - - /* - * Datasheet states 16000 as maximum RPM target - * (table 2.2 and section 4.3) - */ - if ((rpm_target < 0) || (rpm_target > 16000)) - return -EINVAL; - - mutex_lock(&data->update_lock); - - if (rpm_target == 0) - fan->target = 0x1fff; - else - fan->target = clamp_val( - (FAN_RPM_FACTOR * fan->multiplier) / rpm_target, - 0, 0x1fff); - - write_fan_target_to_i2c(client, fan_idx, fan->target); - - mutex_unlock(&data->update_lock); - return 0; -} - -static int -emc2305_set_pwm_enable(struct i2c_client *client, int fan_idx, long enable) -{ - struct emc2305_data *data = i2c_get_clientdata(client); - struct emc2305_fan_data *fan = emc2305_update_fan(client, fan_idx); - const u8 reg_fan_conf1 = SEL_FAN(fan_idx, REG_FAN_CONFIGURATION_1); - int status = 0; - u8 conf_reg; - - mutex_lock(&data->update_lock); - switch (enable) { - case 0: - fan->rpm_control = false; - break; - case 3: - fan->rpm_control = true; - break; - default: - status = -EINVAL; - goto exit_unlock; - } - - status = read_u8_from_i2c(client, reg_fan_conf1, &conf_reg); - if (status < 0) { - status = -EIO; - goto exit_unlock; - } - - if (fan->rpm_control) - conf_reg |= 0x80; - else - conf_reg &= ~0x80; - - status = i2c_smbus_write_byte_data(client, reg_fan_conf1, conf_reg); - if (status < 0) - status = -EIO; - -exit_unlock: - mutex_unlock(&data->update_lock); - return status; -} - -static int -emc2305_set_pwm(struct i2c_client *client, int fan_idx, long pwm) -{ - struct emc2305_data *data = i2c_get_clientdata(client); - struct emc2305_fan_data *fan = emc2305_update_fan(client, fan_idx); - const u8 reg_fan_setting = SEL_FAN(fan_idx, REG_FAN_SETTING); - int status = 0; - - /* - * Datasheet states 255 as maximum PWM - * (section 5.7) - */ - if ((pwm < 0) || (pwm > 255)) - return -EINVAL; - - fan->pwm = pwm; - - mutex_lock(&data->update_lock); - - status = i2c_smbus_write_byte_data(client, reg_fan_setting, fan->pwm); - - mutex_unlock(&data->update_lock); - return status; -} -/* - * sysfs callback functions - * - * Note: - * Naming of the funcs is modelled after the naming scheme described in - * Documentation/hwmon/sysfs-interface: - * - * For a sysfs file _ the functions are named like this: - * the show function: show__ - * the store function: set__ - * For read only (RO) attributes of course only the show func is required. - * - * This convention allows us to define the sysfs attributes by using macros. - */ - -static ssize_t -show_fan_input(struct device *dev, struct device_attribute *da, char *buf) -{ - struct emc2305_fan_data *fan = emc2305_update_device_fan(dev, da); - int rpm = 0; - if (fan->tach != 0) - rpm = (FAN_RPM_FACTOR * fan->multiplier) / fan->tach; - return sprintf(buf, "%d\n", rpm); -} - -static ssize_t -show_fan_fault(struct device *dev, struct device_attribute *da, char *buf) -{ - struct emc2305_fan_data *fan = emc2305_update_device_fan(dev, da); - bool fault = ((fan->tach & 0x1fe0) == 0x1fe0); - return sprintf(buf, "%d\n", fault ? 1 : 0); -} - -static ssize_t -show_fan_div(struct device *dev, struct device_attribute *da, char *buf) -{ - struct emc2305_fan_data *fan = emc2305_update_device_fan(dev, da); - int fan_div = 8 / fan->multiplier; - return sprintf(buf, "%d\n", fan_div); -} - -static ssize_t -set_fan_div(struct device *dev, struct device_attribute *da, - const char *buf, size_t count) -{ - struct i2c_client *client = to_i2c_client(dev); - int fan_idx = to_sensor_dev_attr(da)->index; - long new_div; - int status; - - status = kstrtol(buf, 10, &new_div); - if (status < 0) - return -EINVAL; - - status = emc2305_set_fan_div(client, fan_idx, new_div); - if (status < 0) - return status; - - return count; -} - -static ssize_t -show_fan_target(struct device *dev, struct device_attribute *da, char *buf) -{ - struct emc2305_fan_data *fan = emc2305_update_device_fan(dev, da); - int rpm = 0; - - /* high byte of 0xff indicates disabled so return 0 */ - if ((fan->target != 0) && ((fan->target & 0x1fe0) != 0x1fe0)) - rpm = (FAN_RPM_FACTOR * fan->multiplier) - / fan->target; - - return sprintf(buf, "%d\n", rpm); -} - -static ssize_t set_fan_target(struct device *dev, struct device_attribute *da, - const char *buf, size_t count) -{ - struct i2c_client *client = to_i2c_client(dev); - int fan_idx = to_sensor_dev_attr(da)->index; - long rpm_target; - int status; - - status = kstrtol(buf, 10, &rpm_target); - if (status < 0) - return -EINVAL; - - status = emc2305_set_fan_target(client, fan_idx, rpm_target); - if (status < 0) - return status; - - return count; -} - -static ssize_t -show_pwm_enable(struct device *dev, struct device_attribute *da, char *buf) -{ - struct emc2305_fan_data *fan = emc2305_update_device_fan(dev, da); - return sprintf(buf, "%d\n", fan->rpm_control ? 3 : 0); -} - -static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *da, - const char *buf, size_t count) -{ - struct i2c_client *client = to_i2c_client(dev); - int fan_idx = to_sensor_dev_attr(da)->index; - long new_value; - int status; - - status = kstrtol(buf, 10, &new_value); - if (status < 0) - return -EINVAL; - status = emc2305_set_pwm_enable(client, fan_idx, new_value); - return count; -} - -static ssize_t show_pwm(struct device *dev, struct device_attribute *da, - char *buf) -{ - struct emc2305_fan_data *fan = emc2305_update_device_fan(dev, da); - return sprintf(buf, "%d\n", fan->pwm); -} - -static ssize_t set_pwm(struct device *dev, struct device_attribute *da, - const char *buf, size_t count) -{ - struct i2c_client *client = to_i2c_client(dev); - int fan_idx = to_sensor_dev_attr(da)->index; - unsigned long val; - int ret; - int status; - - ret = kstrtoul(buf, 10, &val); - if (ret) - return ret; - if (val > 255) - return -EINVAL; - - status = emc2305_set_pwm(client, fan_idx, val); - return count; -} - -/* define a read only attribute */ -#define EMC2305_ATTR_RO(_type, _item, _num) \ - SENSOR_ATTR(_type ## _num ## _ ## _item, S_IRUGO, \ - show_## _type ## _ ## _item, NULL, _num - 1) - -/* define a read/write attribute */ -#define EMC2305_ATTR_RW(_type, _item, _num) \ - SENSOR_ATTR(_type ## _num ## _ ## _item, S_IRUGO | S_IWUSR, \ - show_## _type ##_ ## _item, \ - set_## _type ## _ ## _item, _num - 1) - -/* - * TODO: Ugly hack, but temporary as this whole logic needs - * to be rewritten as per standard HWMON sysfs registration - */ - -/* define a read/write attribute */ -#define EMC2305_ATTR_RW2(_type, _num) \ - SENSOR_ATTR(_type ## _num, S_IRUGO | S_IWUSR, \ - show_## _type, set_## _type, _num - 1) - -/* defines the attributes for a single fan */ -#define EMC2305_DEFINE_FAN_ATTRS(_num) \ - static const \ - struct sensor_device_attribute emc2305_attr_fan ## _num[] = { \ - EMC2305_ATTR_RO(fan, input, _num), \ - EMC2305_ATTR_RO(fan, fault, _num), \ - EMC2305_ATTR_RW(fan, div, _num), \ - EMC2305_ATTR_RW(fan, target, _num), \ - EMC2305_ATTR_RW(pwm, enable, _num), \ - EMC2305_ATTR_RW2(pwm, _num) \ - } - -#define EMC2305_NUM_FAN_ATTRS ARRAY_SIZE(emc2305_attr_fan1) - -/* common attributes for EMC2303 and EMC2305 */ -static const struct sensor_device_attribute emc2305_attr_common[] = { -}; - -/* fan attributes for the single fans */ -EMC2305_DEFINE_FAN_ATTRS(1); -EMC2305_DEFINE_FAN_ATTRS(2); -EMC2305_DEFINE_FAN_ATTRS(3); -EMC2305_DEFINE_FAN_ATTRS(4); -EMC2305_DEFINE_FAN_ATTRS(5); -EMC2305_DEFINE_FAN_ATTRS(6); - -/* fan attributes */ -static const struct sensor_device_attribute *emc2305_fan_attrs[] = { - emc2305_attr_fan1, - emc2305_attr_fan2, - emc2305_attr_fan3, - emc2305_attr_fan4, - emc2305_attr_fan5, -}; - -/* - * driver interface - */ - -static int emc2305_remove(struct i2c_client *client) -{ - struct emc2305_data *data = i2c_get_clientdata(client); - int fan_idx, i; - - hwmon_device_unregister(data->hwmon_dev); - - for (fan_idx = 0; fan_idx < data->fans; ++fan_idx) - for (i = 0; i < EMC2305_NUM_FAN_ATTRS; ++i) - device_remove_file( - &client->dev, - &emc2305_fan_attrs[fan_idx][i].dev_attr); - - for (i = 0; i < ARRAY_SIZE(emc2305_attr_common); ++i) - device_remove_file(&client->dev, - &emc2305_attr_common[i].dev_attr); - - kfree(data); - return 0; -} - - -#ifdef CONFIG_OF -/* - * device tree support - */ - -struct of_fan_attribute { - const char *name; - int (*set)(struct i2c_client*, int, long); -}; - -struct of_fan_attribute of_fan_attributes[] = { - {"fan-div", emc2305_set_fan_div}, - {"fan-target", emc2305_set_fan_target}, - {"pwm-enable", emc2305_set_pwm_enable}, - {NULL, NULL} -}; - -static int emc2305_config_of(struct i2c_client *client) -{ - struct emc2305_data *data = i2c_get_clientdata(client); - struct device_node *node; - unsigned int fan_idx; - - if (!client->dev.of_node) - return -EINVAL; - if (!of_get_next_child(client->dev.of_node, NULL)) - return 0; - - for (fan_idx = 0; fan_idx < data->fans; ++fan_idx) - data->fan[fan_idx].enabled = false; - - for_each_child_of_node(client->dev.of_node, node) { - const __be32 *property; - int len; - struct of_fan_attribute *attr; - - property = of_get_property(node, "reg", &len); - if (!property || len != sizeof(int)) { - dev_err(&client->dev, "invalid reg on %s\n", - node->full_name); - continue; - } - - fan_idx = be32_to_cpup(property); - if (fan_idx >= data->fans) { - dev_err(&client->dev, - "invalid fan index %d on %s\n", - fan_idx, node->full_name); - continue; - } - - data->fan[fan_idx].enabled = true; - - for (attr = of_fan_attributes; attr->name; ++attr) { - int status = 0; - long value; - property = of_get_property(node, attr->name, &len); - if (!property) - continue; - if (len != sizeof(int)) { - dev_err(&client->dev, "invalid %s on %s\n", - attr->name, node->full_name); - continue; - } - value = be32_to_cpup(property); - status = attr->set(client, fan_idx, value); - if (status == -EINVAL) { - dev_err(&client->dev, - "invalid value for %s on %s\n", - attr->name, node->full_name); - } - } - } - - return 0; -} - -#endif - -static void emc2305_get_config(struct i2c_client *client) -{ - int i; - struct emc2305_data *data = i2c_get_clientdata(client); - - for (i = 0; i < data->fans; ++i) { - data->fan[i].enabled = true; - emc2305_update_fan(client, i); - } - -#ifdef CONFIG_OF - emc2305_config_of(client); -#endif - -} - -static int -emc2305_probe(struct i2c_client *client, const struct i2c_device_id *id) -{ - struct emc2305_data *data; - int status; - int i; - int fan_idx; - - if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - return -EIO; - - data = kzalloc(sizeof(struct emc2305_data), GFP_KERNEL); - if (!data) - return -ENOMEM; - - i2c_set_clientdata(client, data); - mutex_init(&data->update_lock); - - status = i2c_smbus_read_byte_data(client, REG_PRODUCT_ID); - switch (status) { - case 0x34: /* EMC2305 */ - data->fans = 5; - break; - case 0x35: /* EMC2303 */ - data->fans = 3; - break; - case 0x36: /* EMC2302 */ - data->fans = 2; - break; - case 0x37: /* EMC2301 */ - data->fans = 1; - break; - default: - if (status >= 0) - status = -EINVAL; - goto exit_free; - } - - emc2305_get_config(client); - - for (i = 0; i < ARRAY_SIZE(emc2305_attr_common); ++i) { - status = device_create_file(&client->dev, - &emc2305_attr_common[i].dev_attr); - if (status) - goto exit_remove; - } - for (fan_idx = 0; fan_idx < data->fans; ++fan_idx) - for (i = 0; i < EMC2305_NUM_FAN_ATTRS; ++i) { - if (!data->fan[fan_idx].enabled) - continue; - status = device_create_file( - &client->dev, - &emc2305_fan_attrs[fan_idx][i].dev_attr); - if (status) - goto exit_remove_fans; - } - - data->hwmon_dev = hwmon_device_register(&client->dev); - if (IS_ERR(data->hwmon_dev)) { - status = PTR_ERR(data->hwmon_dev); - goto exit_remove_fans; - } - - dev_info(&client->dev, "%s: sensor '%s'\n", - dev_name(data->hwmon_dev), client->name); - - return 0; - -exit_remove_fans: - for (fan_idx = 0; fan_idx < data->fans; ++fan_idx) - for (i = 0; i < EMC2305_NUM_FAN_ATTRS; ++i) - device_remove_file( - &client->dev, - &emc2305_fan_attrs[fan_idx][i].dev_attr); - -exit_remove: - for (i = 0; i < ARRAY_SIZE(emc2305_attr_common); ++i) - device_remove_file(&client->dev, - &emc2305_attr_common[i].dev_attr); -exit_free: - kfree(data); - return status; -} - -static const struct i2c_device_id emc2305_id[] = { - { "emc2305", 0 }, - { "emc2303", 0 }, - { "emc2302", 0 }, - { "emc2301", 0 }, - { } -}; -MODULE_DEVICE_TABLE(i2c, emc2305_id); - -/* Return 0 if detection is successful, -ENODEV otherwise */ -static int -emc2305_detect(struct i2c_client *new_client, struct i2c_board_info *info) -{ - struct i2c_adapter *adapter = new_client->adapter; - int manufacturer, product; - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - return -ENODEV; - - manufacturer = - i2c_smbus_read_byte_data(new_client, REG_MANUFACTURER_ID); - if (manufacturer != 0x5D) - return -ENODEV; - - product = i2c_smbus_read_byte_data(new_client, REG_PRODUCT_ID); - - switch (product) { - case 0x34: - strlcpy(info->type, "emc2305", I2C_NAME_SIZE); - break; - case 0x35: - strlcpy(info->type, "emc2303", I2C_NAME_SIZE); - break; - case 0x36: - strlcpy(info->type, "emc2302", I2C_NAME_SIZE); - break; - case 0x37: - strlcpy(info->type, "emc2301", I2C_NAME_SIZE); - break; - default: - return -ENODEV; - } - - return 0; -} - -static struct i2c_driver emc2305_driver = { - .class = I2C_CLASS_HWMON, - .driver = { - .name = "emc2305", - }, - .probe = emc2305_probe, - .remove = emc2305_remove, - .id_table = emc2305_id, -/* - .detect = emc2305_detect, - .address_list = i2c_adresses, -*/ -}; - -module_i2c_driver(emc2305_driver); - -MODULE_AUTHOR("Reinhard Pfau "); -MODULE_DESCRIPTION("SMSC EMC2305 hwmon driver"); -MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/mc24lc64t.c b/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/mc24lc64t.c deleted file mode 100644 index a391056d09a7..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/mc24lc64t.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * mc24lc64t.c - driver for Microchip 24LC64T - * - * Copyright (C) 2017 Celestica Corp. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -struct mc24lc64t_data { - struct i2c_client *fake_client; - struct mutex update_lock; -}; - -static ssize_t mc24lc64t_read(struct file *filp, struct kobject *kobj, - struct bin_attribute *bin_attr, - char *buf, loff_t off, size_t count) -{ - struct i2c_client *client = kobj_to_i2c_client(kobj); - struct mc24lc64t_data *drvdata = i2c_get_clientdata(client); - unsigned long timeout, read_time, i = 0; - int status; - - mutex_lock(&drvdata->update_lock); - - if (i2c_smbus_write_byte_data(client, off>>8, off)) - { - status = -EIO; - goto exit; - } - - msleep(1); - -begin: - - if (i < count) - { - timeout = jiffies + msecs_to_jiffies(25); /* 25 mS timeout*/ - do { - read_time = jiffies; - - status = i2c_smbus_read_byte(client); - if (status >= 0) - { - buf[i++] = status; - goto begin; - } - } while (time_before(read_time, timeout)); - - status = -ETIMEDOUT; - goto exit; - } - - status = count; - -exit: - mutex_unlock(&drvdata->update_lock); - - return status; -} - -static struct bin_attribute mc24lc64t_bit_attr = { - .attr = { - .name = "eeprom", - .mode = S_IRUGO, - }, - .size = 65536, - .read = mc24lc64t_read, -}; - -static int mc24lc64t_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - struct i2c_adapter *adapter = client->adapter; - struct mc24lc64t_data *drvdata; - int err; - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WRITE_BYTE_DATA - | I2C_FUNC_SMBUS_READ_BYTE)) - return -EPFNOSUPPORT; - - if (!(drvdata = devm_kzalloc(&client->dev, - sizeof(struct mc24lc64t_data), GFP_KERNEL))) - return -ENOMEM; - - drvdata->fake_client = i2c_new_dummy(client->adapter, client->addr + 1); - if (!drvdata->fake_client) - return -ENOMEM; - - i2c_set_clientdata(client, drvdata); - mutex_init(&drvdata->update_lock); - - err = sysfs_create_bin_file(&client->dev.kobj, &mc24lc64t_bit_attr); - if (err) - i2c_unregister_device(drvdata->fake_client); - - return err; -} - -static int mc24lc64t_remove(struct i2c_client *client) -{ - struct mc24lc64t_data *drvdata = i2c_get_clientdata(client); - - i2c_unregister_device(drvdata->fake_client); - - sysfs_remove_bin_file(&client->dev.kobj, &mc24lc64t_bit_attr); - - return 0; -} - -static const struct i2c_device_id mc24lc64t_id[] = { - { "24lc64t", 0 }, - { } -}; -MODULE_DEVICE_TABLE(i2c, mc24lc64t_id); - -static struct i2c_driver mc24lc64t_driver = { - .driver = { - .name = "mc24lc64t", - .owner = THIS_MODULE, - }, - .probe = mc24lc64t_probe, - .remove = mc24lc64t_remove, - .id_table = mc24lc64t_id, -}; - -module_i2c_driver(mc24lc64t_driver); - -MODULE_AUTHOR("Abhisit Sangjan "); -MODULE_DESCRIPTION("Microchip 24LC64T Driver"); -MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/smc.c b/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/smc.c deleted file mode 100644 index 7b8d410cdd2b..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/smc.c +++ /dev/null @@ -1,1039 +0,0 @@ -/* - * smc.c - The CPLD driver for E1031 System Management. - * The driver implement sysfs to access CPLD register on the E1031 via LPC bus. - * Copyright (C) 2018 Celestica Corp. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#define DRIVER_NAME "e1031.smc" - -/** - * CPLD register address for read and write. - */ -#define VERSION 0x0200 -#define SCRATCH 0x0201 -#define BROAD_ID 0x0202 - -/* SEPERATE RESET - * [7:5] RESERVED - * [4] RESET PCIE - * [3] RESET USBHUB - * [2] RESET B50282 - * [1] RESET PCA9548 - * [0] RESET BCM54616 - * 1: not reset, 0: reset - */ -#define SPR_RESET 0x0222 - -/* PSU STATUS - * [7] PSUR_ACOK - * [6] PSUR_PWOK - * [5] PSUR_ALRT - * [4] PSUR_PRS - * [3] PSUL_ACOK - * [2] PSUL_PWOK - * [1] PSUL_ALRT - * [0] PSUL_PRS - */ -#define PSU_STAT 0x0204 -#define PSUR_ACOK 7 -#define PSUR_PWOK 6 -#define PSUR_ALRT 5 -#define PSUR_PRS 4 -#define PSUL_ACOK 3 -#define PSUL_PWOK 2 -#define PSUL_ALRT 1 -#define PSUL_PRS 0 - -/* FAN LED CTRL - * [7:3] RESERVED - * [2:0] LED CTRL - */ -#define FAN_LED_1 0x0205 -#define FAN_LED_2 0x0206 -#define FAN_LED_3 0x0207 - -enum FAN_LED { - fan_led_grn = 0, - fan_led_grn_bnk, - fan_led_amb, - fan_led_amb_bnk, - fan_led_off -} fan_led; - -#define LED_OPMOD 0x0208 -#define LED_TEST 0x0209 - -/* SYSTEM LED - * [7:4] RESERVED - * [3:2] STATUS LED - * [1:0] MASTER LED - */ -#define LED_FPS 0x020a - -enum STAT_LED { - stat_led_off = 0, - stat_led_grn, - stat_led_grn_bnk -} stat_led; - -enum MASTER_LED { - master_led_off = 0, - master_led_grn, - master_led_amb -} master_led; - -/* FAN DIRECTION STAT - * [7:4] RESERVED - * [3] USB HUB STAT - * [2:0] FAN_DIR - */ -#define DEV_STAT 0x020c -#define FAN_3 2 -#define FAN_2 1 -#define FAN_1 0 - -/* SFP PORT INT TRIGGER MODE - * [7:6] RESERVED - * [5:4] RXLOS - * [3:2] MODABS - * [1:0] TXFAULT - * 00: falling edge, - * 01: rising edge, - * 10: Both edges, - * 11: low level detect - */ -#define TRIG_MODE 0x0240 -#define TXFAULT_TRIG 0 -#define MODABS_TRIG 2 -#define RXLOS_TRIG 4 - - -/* SFP PORT STATUS - * [7:4] RESERVED - * [3:0] TX_FAULT / MODABS / RXLOS - */ -#define SFP_TXFAULT 0x0242 -#define SFP_MODABS 0x0243 -#define SFP_RXLOS 0x0244 - -/* SFP PORT INTERRUPT - * [7:4] RESERVED - * [3:0] TX_FAULT / MODABS / RXLOS - * 1: int, 0: no int - */ -#define TXFAULT_INT 0x0246 -#define MODABS_INT 0x0247 -#define RXLOS_INT 0x0248 - -/* INTERRUPT MASK REGISTER - * [7:4] RESERVED - * [3:0] TX_FAULT / MODABS / RXLOS - * 1: mask, 0: not mask - */ -#define TXFAULT_MSK 0x024A -#define MODABS_MSK 0x024B -#define RXLOS_MSK 0x024C - -/* SFP PORT CTRL - * [7:4] RATE SEL (RS0/RS1) - * [3:0] TX_DIS - */ -#define SFP_TXCTRL 0x0255 - -struct cpld_data { - struct mutex cpld_lock; - uint16_t read_addr; - struct device *fpp_node; - struct device *sfp_devices[4]; -}; - -struct sfp_device_data { - int portid; -}; - -struct class *celplatform; -struct cpld_data *cpld_data; - -struct index_device_attribute { - struct device_attribute dev_attr; - int index; -}; - -static ssize_t scratch_show(struct device *dev, struct device_attribute *devattr, - char *buf) -{ - unsigned char data = 0; - mutex_lock(&cpld_data->cpld_lock); - data = inb(SCRATCH); - mutex_unlock(&cpld_data->cpld_lock); - return sprintf(buf, "0x%2.2x\n", data); -} - -static ssize_t scratch_store(struct device *dev, struct device_attribute *devattr, - const char *buf, size_t count) -{ - unsigned long data; - char *last; - - mutex_lock(&cpld_data->cpld_lock); - data = (uint16_t)strtoul(buf, &last, 16); - if (data == 0 && buf == last) { - mutex_unlock(&cpld_data->cpld_lock); - return -EINVAL; - } - outb(data, SCRATCH); - mutex_unlock(&cpld_data->cpld_lock); - return count; -} - - -static ssize_t version_show(struct device *dev, struct device_attribute *attr, char *buf) -{ - int len = 0; - mutex_lock(&cpld_data->cpld_lock); - len = sprintf(buf, "0x%2.2x\n", inb(VERSION)); - mutex_unlock(&cpld_data->cpld_lock); - return len; -} - -static ssize_t getreg_store(struct device *dev, struct device_attribute *devattr, - const char *buf, size_t count) -{ - uint16_t addr; - char *last; - - addr = (uint16_t)strtoul(buf, &last, 16); - if (addr == 0 && buf == last) { - return -EINVAL; - } - cpld_data->read_addr = addr; - return count; -} - -static ssize_t getreg_show(struct device *dev, struct device_attribute *attr, char *buf) -{ - int len = 0; - mutex_lock(&cpld_data->cpld_lock); - len = sprintf(buf, "0x%2.2x\n", inb(cpld_data->read_addr)); - mutex_unlock(&cpld_data->cpld_lock); - return len; -} - -static ssize_t setreg_store(struct device *dev, struct device_attribute *devattr, - const char *buf, size_t count) -{ - uint16_t addr; - uint8_t value; - char *tok; - char clone[count]; - char *pclone = clone; - char *last; - - strcpy(clone, buf); - - mutex_lock(&cpld_data->cpld_lock); - tok = strsep((char**)&pclone, " "); - if (tok == NULL) { - mutex_unlock(&cpld_data->cpld_lock); - return -EINVAL; - } - addr = (uint16_t)strtoul(tok, &last, 16); - if (addr == 0 && tok == last) { - mutex_unlock(&cpld_data->cpld_lock); - return -EINVAL; - } - - tok = strsep((char**)&pclone, " "); - if (tok == NULL) { - mutex_unlock(&cpld_data->cpld_lock); - return -EINVAL; - } - value = (uint8_t)strtoul(tok, &last, 16); - if (value == 0 && tok == last) { - mutex_unlock(&cpld_data->cpld_lock); - return -EINVAL; - } - - outb(value, addr); - mutex_unlock(&cpld_data->cpld_lock); - return count; -} - -/** - * @brief Show status led - * @param dev kernel device - * @param devattr kernel device attribute - * @param buf buffer for get value - * @return led state - off/on/blink - */ -static ssize_t status_led_show(struct device *dev, struct device_attribute *devattr, - char *buf) -{ - unsigned char data = 0; - mutex_lock(&cpld_data->cpld_lock); - data = inb(LED_FPS); - mutex_unlock(&cpld_data->cpld_lock); - data = data & 0xc; - return sprintf(buf, "%s\n", - data == stat_led_grn ? "on" : data == stat_led_grn_bnk ? "blink" : "off"); -} - -/** - * @brief Set the status led - * @param dev kernel device - * @param devattr kernel device attribute - * @param buf buffer of set value - off/on/blink - * @param count number of bytes in buffer - * @return number of bytes written, or error code < 0. - */ -static ssize_t status_led_store(struct device *dev, struct device_attribute *devattr, - const char *buf, size_t count) -{ - unsigned char led_status, data; - - if (sysfs_streq(buf, "off")) { - led_status = stat_led_off; - } else if (sysfs_streq(buf, "on")) { - led_status = stat_led_grn; - } else if (sysfs_streq(buf, "blink")) { - led_status = stat_led_grn_bnk; - } else { - count = -EINVAL; - return count; - } - mutex_lock(&cpld_data->cpld_lock); - data = inb(LED_FPS); - data = data & ~(0xc); - data = data | ( led_status << 2 ); - outb(data, LED_FPS); - mutex_unlock(&cpld_data->cpld_lock); - return count; -} - -/** - * @brief Show master led - * @param dev kernel device - * @param devattr kernel device attribute - * @param buf buffer for get value - * @return led state - off/green/amber - */ -static ssize_t master_led_show(struct device *dev, struct device_attribute *devattr, - char *buf) -{ - unsigned char data = 0; - mutex_lock(&cpld_data->cpld_lock); - data = inb(LED_FPS); - mutex_unlock(&cpld_data->cpld_lock); - data = data & 0x3; - return sprintf(buf, "%s\n", - data == master_led_grn ? "on" : data == master_led_amb ? "amber" : "off"); -} - -/** - * @brief Set the master led - * @param dev kernel device - * @param devattr kernel device attribute - * @param buf buffer of set value - off/green/amber - * @param count number of bytes in buffer - * @return number of bytes written, or error code < 0. - */ -static ssize_t master_led_store(struct device *dev, struct device_attribute *devattr, - const char *buf, size_t count) -{ - unsigned char led_status, data; - - if (sysfs_streq(buf, "off")) { - led_status = master_led_off; - } else if (sysfs_streq(buf, "green")) { - led_status = master_led_grn; - } else if (sysfs_streq(buf, "amber")) { - led_status = master_led_amb; - } else { - count = -EINVAL; - return count; - } - mutex_lock(&cpld_data->cpld_lock); - data = inb(LED_FPS); - data = data & ~(0x3); - data = data | led_status; - outb(data, LED_FPS); - mutex_unlock(&cpld_data->cpld_lock); - return count; -} - -static ssize_t psuL_prs_show(struct device *dev, struct device_attribute *devattr, - char *buf) -{ - unsigned char data = 0; - mutex_lock(&cpld_data->cpld_lock); - data = inb(PSU_STAT); - mutex_unlock(&cpld_data->cpld_lock); - return sprintf(buf, "%d\n", ~(data >> PSUL_PRS) & 1U); -} - -static ssize_t psuR_prs_show(struct device *dev, struct device_attribute *devattr, - char *buf) -{ - unsigned char data = 0; - mutex_lock(&cpld_data->cpld_lock); - data = inb(PSU_STAT); - mutex_unlock(&cpld_data->cpld_lock); - return sprintf(buf, "%d\n", ~(data >> PSUR_PRS) & 1U); -} -static DEVICE_ATTR_RO(psuR_prs); - -static ssize_t psuL_status_show(struct device *dev, struct device_attribute *devattr, - char *buf) -{ - unsigned char data = 0; - mutex_lock(&cpld_data->cpld_lock); - data = inb(PSU_STAT); - mutex_unlock(&cpld_data->cpld_lock); - data = ( data >> PSUL_PWOK ) & 0x3; - return sprintf(buf, "%d\n", data == 0x3 ); -} - -static ssize_t psuR_status_show(struct device *dev, struct device_attribute *devattr, - char *buf) -{ - unsigned char data = 0; - mutex_lock(&cpld_data->cpld_lock); - data = inb(PSU_STAT); - mutex_unlock(&cpld_data->cpld_lock); - data = ( data >> PSUR_PWOK ) & 0x3; - return sprintf(buf, "%d\n", data == 0x3 ); -} - - -static ssize_t fan_dir_show(struct device *dev, struct device_attribute *devattr, - char *buf) -{ - struct sensor_device_attribute *sa = to_sensor_dev_attr(devattr); - int index = sa->index; - unsigned char data = 0; - mutex_lock(&cpld_data->cpld_lock); - data = inb(DEV_STAT); - mutex_unlock(&cpld_data->cpld_lock); - data = ( data >> index ) & 1U; - return sprintf(buf, "%s\n", data ? "B2F" : "F2B" ); -} - -static ssize_t sfp_txfault_show(struct device *dev, struct device_attribute *attr, char *buf) -{ - unsigned char data; - mutex_lock(&cpld_data->cpld_lock); - data = inb(SFP_TXFAULT); - data = data & 0x0F; - mutex_unlock(&cpld_data->cpld_lock); - return sprintf(buf, "0x%x\n", data); -} - -static ssize_t sfp_modabs_show(struct device *dev, struct device_attribute *attr, char *buf) -{ - unsigned char data; - mutex_lock(&cpld_data->cpld_lock); - data = inb(SFP_MODABS); - data = data & 0x0F; - mutex_unlock(&cpld_data->cpld_lock); - return sprintf(buf, "0x%x\n", data); -} - -static ssize_t sfp_rxlos_show(struct device *dev, struct device_attribute *attr, char *buf) -{ - unsigned char data; - mutex_lock(&cpld_data->cpld_lock); - data = inb(SFP_RXLOS); - data = data & 0x0F; - mutex_unlock(&cpld_data->cpld_lock); - return sprintf(buf, "0x%x\n", data); -} - -static ssize_t sfp_txdis_show(struct device *dev, struct device_attribute *attr, char *buf) -{ - unsigned char data; - mutex_lock(&cpld_data->cpld_lock); - data = inb(SFP_TXCTRL); - data = data & 0x0F; - mutex_unlock(&cpld_data->cpld_lock); - return sprintf(buf, "0x%x\n", data); -} - -static ssize_t sfp_txdis_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) -{ - long value; - ssize_t status; - unsigned char data; - - mutex_lock(&cpld_data->cpld_lock); - status = kstrtol(buf, 0, &value); - if (status == 0) { - data = inb(SFP_TXCTRL); - data = data & ~(0x0F); - data = data | (value & 0x0F); - outb(data, SFP_TXCTRL); - status = size; - } - mutex_unlock(&cpld_data->cpld_lock); - return status; -} - -static ssize_t sfp_rs_show(struct device *dev, struct device_attribute *attr, char *buf) -{ - unsigned char data; - mutex_lock(&cpld_data->cpld_lock); - data = inb(SFP_TXCTRL) >> 4; - data = data & 0x0F; - mutex_unlock(&cpld_data->cpld_lock); - return sprintf(buf, "0x%x\n", data); -} - -static ssize_t sfp_rs_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) -{ - long value; - ssize_t status; - unsigned char data; - - mutex_lock(&cpld_data->cpld_lock); - status = kstrtol(buf, 0, &value); - value = (value & 0x0F) << 4; - if (status == 0) { - data = inb(SFP_TXCTRL); - data = data & ~(0xF0); - data = data | value; - outb(data, SFP_TXCTRL); - status = size; - } - mutex_unlock(&cpld_data->cpld_lock); - return status; -} - -/** - * @brief Show the avaliable interrupt trigger mode. - * "none" means the interrupt is masked. - * - * @return Current trigger mode. - */ -static ssize_t txfault_trig_show(struct device *dev, struct device_attribute *attr, char *buf) -{ - unsigned char mode; - char *mode_str[5] = {"falling", "rising", "both", "low"}; - - mutex_lock(&cpld_data->cpld_lock); - mode = inb(TRIG_MODE) >> TXFAULT_TRIG; - mode = mode & 0x3; - mutex_unlock(&cpld_data->cpld_lock); - return sprintf(buf, "%s\n", mode_str[mode]); -} - -/** - * @brief Set the trigger mode of each interrupt type. - * Only one trigger mode allow in a type. - * - * @param buf The trigger mode of follwings - * "falling", "rising", "both" - */ -static ssize_t txfault_trig_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) -{ - ssize_t status; - unsigned char data, trig_mode; - - if (sysfs_streq(buf, "falling")) { - trig_mode = 0; - } else if (sysfs_streq(buf, "rising")) { - trig_mode = 1; - } else if (sysfs_streq(buf, "both")) { - trig_mode = 2; - } else if (sysfs_streq(buf, "low")) { - trig_mode = 3; - } else { - status = -EINVAL; - return status; - } - - mutex_lock(&cpld_data->cpld_lock); - data = inb(TRIG_MODE); - data = data & ~(0x03 << TXFAULT_TRIG); - data = data | trig_mode << TXFAULT_TRIG; - outb(data, TRIG_MODE); - mutex_unlock(&cpld_data->cpld_lock); - status = size; - return status; -} - -/** - * @brief Show the avaliable interrupt trigger mode. - * "none" means the interrupt is masked. - * - * @return Current trigger mode. - */ -static ssize_t modabs_trig_show(struct device *dev, struct device_attribute *attr, char *buf) -{ - unsigned char mode; - char *mode_str[5] = {"falling", "rising", "both", "low"}; - - mutex_lock(&cpld_data->cpld_lock); - mode = inb(TRIG_MODE) >> MODABS_TRIG; - mode = mode & 0x3; - mutex_unlock(&cpld_data->cpld_lock); - return sprintf(buf, "%s\n", mode_str[mode]); -} - -/** - * @brief Set the trigger mode of each interrupt type. - * Only one trigger mode allow in a type. - * - * @param buf The trigger mode of follwings - * "falling", "rising", "both", "low" - */ -static ssize_t modabs_trig_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) -{ - ssize_t status; - unsigned char data, trig_mode; - - if (sysfs_streq(buf, "falling")) { - trig_mode = 0; - } else if (sysfs_streq(buf, "rising")) { - trig_mode = 1; - } else if (sysfs_streq(buf, "both")) { - trig_mode = 2; - } else if (sysfs_streq(buf, "low")) { - trig_mode = 3; - } else { - status = -EINVAL; - return status; - } - - mutex_lock(&cpld_data->cpld_lock); - data = inb(TRIG_MODE); - data = data & ~(0x03 << MODABS_TRIG); - data = data | trig_mode << MODABS_TRIG; - outb(data, TRIG_MODE); - mutex_unlock(&cpld_data->cpld_lock); - status = size; - return status; -} - -/** - * @brief Show the avaliable interrupt trigger mode. - * "none" means the interrupt is masked. - * - * @return Current trigger mode. - */ -static ssize_t rxlos_trig_show(struct device *dev, struct device_attribute *attr, char *buf) -{ - unsigned char mode; - char *mode_str[5] = {"falling", "rising", "both", "low"}; - - mutex_lock(&cpld_data->cpld_lock); - mode = inb(TRIG_MODE) >> RXLOS_TRIG; - mode = mode & 0x3; - mutex_unlock(&cpld_data->cpld_lock); - return sprintf(buf, "%s\n", mode_str[mode]); -} - -/** - * @brief Set the trigger mode of each interrupt type. - * Only one trigger mode allow in a type. - * - * @param buf The trigger mode of follwings - * "falling", "rising", "both", "low" - */ -static ssize_t rxlos_trig_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) -{ - ssize_t status; - unsigned char data, trig_mode; - - if (sysfs_streq(buf, "falling")) { - trig_mode = 0; - } else if (sysfs_streq(buf, "rising")) { - trig_mode = 1; - } else if (sysfs_streq(buf, "both")) { - trig_mode = 2; - } else if (sysfs_streq(buf, "low")) { - trig_mode = 3; - } else { - status = -EINVAL; - return status; - } - - mutex_lock(&cpld_data->cpld_lock); - data = inb(TRIG_MODE); - data = data & ~(0x03 << RXLOS_TRIG); - data = data | trig_mode << RXLOS_TRIG; - outb(data, TRIG_MODE); - mutex_unlock(&cpld_data->cpld_lock); - status = size; - return status; -} - -static ssize_t txfault_int_show(struct device *dev, struct device_attribute *attr, char *buf) -{ - unsigned char data; - mutex_lock(&cpld_data->cpld_lock); - data = inb(TXFAULT_INT); - data = data & 0x0F; - mutex_unlock(&cpld_data->cpld_lock); - return sprintf(buf, "0x%x\n", data); -} - -static ssize_t modabs_int_show(struct device *dev, struct device_attribute *attr, char *buf) -{ - unsigned char data; - mutex_lock(&cpld_data->cpld_lock); - data = inb(MODABS_INT); - data = data & 0x0F; - mutex_unlock(&cpld_data->cpld_lock); - return sprintf(buf, "0x%x\n", data); -} - -static ssize_t rxlos_int_show(struct device *dev, struct device_attribute *attr, char *buf) -{ - unsigned char data; - mutex_lock(&cpld_data->cpld_lock); - data = inb(RXLOS_INT); - data = data & 0x0F; - mutex_unlock(&cpld_data->cpld_lock); - return sprintf(buf, "0x%x\n", data); -} - -static ssize_t txfault_mask_show(struct device *dev, struct device_attribute *attr, char *buf) -{ - unsigned char data; - mutex_lock(&cpld_data->cpld_lock); - data = inb(TXFAULT_MSK); - data = data & 0x0F; - mutex_unlock(&cpld_data->cpld_lock); - return sprintf(buf, "0x%x\n", data); -} - -static ssize_t txfault_mask_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) -{ - long value; - ssize_t status; - - status = kstrtol(buf, 0, &value); - value = value & 0x0F; - if (status == 0) { - mutex_lock(&cpld_data->cpld_lock); - outb(value, TXFAULT_MSK); - mutex_unlock(&cpld_data->cpld_lock); - status = size; - } - return status; -} - -static ssize_t modabs_mask_show(struct device *dev, struct device_attribute *attr, char *buf) -{ - unsigned char data; - mutex_lock(&cpld_data->cpld_lock); - data = inb(MODABS_MSK); - data = data & 0x0F; - mutex_unlock(&cpld_data->cpld_lock); - return sprintf(buf, "0x%x\n", data); -} - -static ssize_t modabs_mask_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) -{ - long value; - ssize_t status; - - status = kstrtol(buf, 0, &value); - value = value & 0x0F; - if (status == 0) { - mutex_lock(&cpld_data->cpld_lock); - outb(value, MODABS_MSK); - mutex_unlock(&cpld_data->cpld_lock); - status = size; - } - return status; -} - -static ssize_t rxlos_mask_show(struct device *dev, struct device_attribute *attr, char *buf) -{ - unsigned char data; - mutex_lock(&cpld_data->cpld_lock); - data = inb(RXLOS_MSK); - data = data & 0x0F; - mutex_unlock(&cpld_data->cpld_lock); - return sprintf(buf, "0x%x\n", data); -} - -static ssize_t rxlos_mask_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) -{ - long value; - ssize_t status; - - status = kstrtol(buf, 0, &value); - value = value & 0x0F; - if (status == 0) { - mutex_lock(&cpld_data->cpld_lock); - outb(value, RXLOS_MSK); - mutex_unlock(&cpld_data->cpld_lock); - status = size; - } - return status; -} - -static ssize_t fan_led_show(struct device *dev, struct device_attribute *devattr, - char *buf) -{ - struct sensor_device_attribute *sa = to_sensor_dev_attr(devattr); - int index = sa->index; - unsigned char data = 0; - char *led_str[5] = {"green", "green-blink", "amber", "amber-blink", "off"}; - - // Use index to determind the status bit - mutex_lock(&cpld_data->cpld_lock); - data = inb(FAN_LED_1 + index); - data = data & 0x7; - mutex_unlock(&cpld_data->cpld_lock); - return sprintf(buf, "%s\n", led_str[data]); -} - -static ssize_t fan_led_store(struct device *dev, struct device_attribute *devattr, - const char *buf, size_t count) -{ - struct sensor_device_attribute *sa = to_sensor_dev_attr(devattr); - int index = sa->index; - unsigned char led_status = 0; - - if (sysfs_streq(buf, "off")) { - led_status = fan_led_off; - } else if (sysfs_streq(buf, "green")) { - led_status = fan_led_grn; - } else if (sysfs_streq(buf, "amber")) { - led_status = fan_led_amb; - } else if (sysfs_streq(buf, "green-blink")) { - led_status = fan_led_grn_bnk; - } else if (sysfs_streq(buf, "amber-blink")) { - led_status = fan_led_amb_bnk; - } else { - count = -EINVAL; - return count; - } - mutex_lock(&cpld_data->cpld_lock); - outb(led_status, FAN_LED_1 + index); - mutex_unlock(&cpld_data->cpld_lock); - return count; -} - -static DEVICE_ATTR_RO(version); -static DEVICE_ATTR_RW(scratch); -static DEVICE_ATTR_RW(getreg); -static DEVICE_ATTR_WO(setreg); -static DEVICE_ATTR_RW(status_led); -static DEVICE_ATTR_RW(master_led); -static DEVICE_ATTR_RO(psuL_prs); -static DEVICE_ATTR_RO(psuL_status); -static DEVICE_ATTR_RO(psuR_status); -static DEVICE_ATTR_RO(sfp_txfault); -static DEVICE_ATTR_RO(sfp_modabs); -static DEVICE_ATTR_RO(sfp_rxlos); -static DEVICE_ATTR_RW(sfp_txdis); -static DEVICE_ATTR_RW(sfp_rs); -static DEVICE_ATTR_RW(txfault_trig); -static DEVICE_ATTR_RW(modabs_trig); -static DEVICE_ATTR_RW(rxlos_trig); -static DEVICE_ATTR_RO(txfault_int); -static DEVICE_ATTR_RO(modabs_int); -static DEVICE_ATTR_RO(rxlos_int); -static DEVICE_ATTR_RW(txfault_mask); -static DEVICE_ATTR_RW(modabs_mask); -static DEVICE_ATTR_RW(rxlos_mask); -static SENSOR_DEVICE_ATTR(fan1_dir, S_IRUGO, fan_dir_show, NULL, FAN_1); -static SENSOR_DEVICE_ATTR(fan2_dir, S_IRUGO, fan_dir_show, NULL, FAN_2); -static SENSOR_DEVICE_ATTR(fan3_dir, S_IRUGO, fan_dir_show, NULL, FAN_3); -static SENSOR_DEVICE_ATTR(fan1_led, S_IWUSR | S_IRUGO, fan_led_show, fan_led_store, FAN_1); -static SENSOR_DEVICE_ATTR(fan2_led, S_IWUSR | S_IRUGO, fan_led_show, fan_led_store, FAN_2); -static SENSOR_DEVICE_ATTR(fan3_led, S_IWUSR | S_IRUGO, fan_led_show, fan_led_store, FAN_3); - -static struct attribute *cpld_attrs[] = { - &dev_attr_version.attr, - &dev_attr_scratch.attr, - &dev_attr_getreg.attr, - &dev_attr_setreg.attr, - // LEDs - &dev_attr_status_led.attr, - &dev_attr_master_led.attr, - // PSUs - &dev_attr_psuL_prs.attr, - &dev_attr_psuR_prs.attr, - &dev_attr_psuL_status.attr, - &dev_attr_psuR_status.attr, - // FANs - &sensor_dev_attr_fan1_dir.dev_attr.attr, - &sensor_dev_attr_fan2_dir.dev_attr.attr, - &sensor_dev_attr_fan3_dir.dev_attr.attr, - &sensor_dev_attr_fan1_led.dev_attr.attr, - &sensor_dev_attr_fan2_led.dev_attr.attr, - &sensor_dev_attr_fan3_led.dev_attr.attr, - NULL, -}; - -static struct attribute_group cpld_group = { - .attrs = cpld_attrs, -}; - -static struct attribute *sfp_attrs[] = { - // SFP - &dev_attr_sfp_txfault.attr, - &dev_attr_sfp_modabs.attr, - &dev_attr_sfp_rxlos.attr, - &dev_attr_sfp_txdis.attr, - &dev_attr_sfp_rs.attr, - &dev_attr_txfault_trig.attr, - &dev_attr_modabs_trig.attr, - &dev_attr_rxlos_trig.attr, - &dev_attr_txfault_int.attr, - &dev_attr_modabs_int.attr, - &dev_attr_rxlos_int.attr, - &dev_attr_txfault_mask.attr, - &dev_attr_modabs_mask.attr, - &dev_attr_rxlos_mask.attr, - NULL, -}; - -ATTRIBUTE_GROUPS(sfp); - -static struct resource cpld_resources[] = { - { - .start = 0x0200, - .end = 0x0255, - .flags = IORESOURCE_IO, - }, -}; - -static void cpld_dev_release( struct device * dev) -{ - return; -} - -static struct platform_device cpld_dev = { - .name = DRIVER_NAME, - .id = -1, - .num_resources = ARRAY_SIZE(cpld_resources), - .resource = cpld_resources, - .dev = { - .release = cpld_dev_release, - } -}; - -static int cpld_drv_probe(struct platform_device *pdev) -{ - struct resource *res; - int err; - - cpld_data = devm_kzalloc(&pdev->dev, sizeof(struct cpld_data), - GFP_KERNEL); - if (!cpld_data) - return -ENOMEM; - - mutex_init(&cpld_data->cpld_lock); - - cpld_data->read_addr = VERSION; - - res = platform_get_resource(pdev, IORESOURCE_IO, 0); - if (unlikely(!res)) { - printk(KERN_ERR "Specified Resource Not Available...\n"); - return -ENODEV; - } - - err = sysfs_create_group(&pdev->dev.kobj, &cpld_group); - if (err) { - printk(KERN_ERR "Cannot create sysfs for SMC.\n"); - return err; - } - - celplatform = class_create(THIS_MODULE, "celplatform"); - if (IS_ERR(celplatform)) { - printk(KERN_ERR "Failed to register device class\n"); - sysfs_remove_group(&pdev->dev.kobj, &cpld_group); - return PTR_ERR(celplatform); - } - - cpld_data->fpp_node = device_create_with_groups(celplatform, NULL, MKDEV(0, 0), NULL, sfp_groups, "optical_ports"); - - if (IS_ERR(cpld_data->fpp_node)) { - class_destroy(celplatform); - sysfs_remove_group(&pdev->dev.kobj, &cpld_group); - return PTR_ERR(cpld_data->fpp_node); - } - - err = sysfs_create_link(&pdev->dev.kobj, &cpld_data->fpp_node->kobj, "SFP"); - if (err != 0) { - put_device(cpld_data->fpp_node); - device_unregister(cpld_data->fpp_node); - class_destroy(celplatform); - sysfs_remove_group(&pdev->dev.kobj, &cpld_group); - return err; - } - - // Clear all reset signals - outb(0xFF, SPR_RESET); - return 0; -} - -static int cpld_drv_remove(struct platform_device *pdev) -{ - device_unregister(cpld_data->fpp_node); - put_device(cpld_data->fpp_node); - sysfs_remove_group(&pdev->dev.kobj, &cpld_group); - class_destroy(celplatform); - return 0; -} - -static struct platform_driver cpld_drv = { - .probe = cpld_drv_probe, - .remove = __exit_p(cpld_drv_remove), - .driver = { - .name = DRIVER_NAME, - }, -}; - -int cpld_init(void) -{ - // Register platform device and platform driver - platform_device_register(&cpld_dev); - platform_driver_register(&cpld_drv); - return 0; -} - -void cpld_exit(void) -{ - // Unregister platform device and platform driver - platform_driver_unregister(&cpld_drv); - platform_device_unregister(&cpld_dev); -} - -module_init(cpld_init); -module_exit(cpld_exit); - - -MODULE_AUTHOR("Celestica Inc."); -MODULE_DESCRIPTION("Celestica E1031 SMC driver"); -MODULE_VERSION("1.0.0"); -MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-cel/haliburton/systemd/platform-modules-haliburton.service b/platform/broadcom/sonic-platform-modules-cel/haliburton/systemd/platform-modules-haliburton.service deleted file mode 100644 index bf1295038856..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/haliburton/systemd/platform-modules-haliburton.service +++ /dev/null @@ -1,14 +0,0 @@ - -[Unit] -Description=Celestica haliburton platform modules -After=local-fs.target -Before=pmon.service - -[Service] -Type=oneshot -ExecStart=-/etc/init.d/platform-modules-haliburton start -ExecStop=-/etc/init.d/platform-modules-haliburton stop -RemainAfterExit=yes - -[Install] -WantedBy=multi-user.target \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-dell/common/dell_ich.c b/platform/broadcom/sonic-platform-modules-dell/common/dell_ich.c index 8bfe4295cb64..cce36e9056fa 100644 --- a/platform/broadcom/sonic-platform-modules-dell/common/dell_ich.c +++ b/platform/broadcom/sonic-platform-modules-dell/common/dell_ich.c @@ -1038,5 +1038,6 @@ MODULE_LICENSE("GPL"); MODULE_ALIAS("platform:"DRV_NAME); MODULE_PARM_DESC(force_id, "Override the detected device ID"); +MODULE_SOFTDEP("pre: lpc_ich"); module_init(dell_ich_init); module_exit(dell_ich_exit); diff --git a/platform/mellanox/criu.mk b/platform/mellanox/criu.mk deleted file mode 100644 index 01a425bb2a8a..000000000000 --- a/platform/mellanox/criu.mk +++ /dev/null @@ -1,8 +0,0 @@ -CRIU_VERSION = 3.10 - -export CRIU_VERSION - -CRIU = criu_$(CRIU_VERSION)-1_amd64.deb -$(CRIU)_SRC_PATH = $(PLATFORM_PATH)/criu -$(CRIU)_DEPENDS += $(LIBNL3_DEV) -SONIC_MAKE_DEBS += $(CRIU) diff --git a/platform/mellanox/criu/Makefile b/platform/mellanox/criu/Makefile deleted file mode 100644 index e9d49b569042..000000000000 --- a/platform/mellanox/criu/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -.ONESHELL: -SHELL = /bin/bash -.SHELLFLAGS += -e - -MAIN_TARGET = criu_$(CRIU_VERSION)-1_amd64.deb - -CRIU_DEPS = iptables,protobuf-c-compiler,protobuf-compiler,python-protobuf,libprotobuf-c1,python-future,python-ipaddr,libnet1,pkg-config,asciidoc,xmlto - -$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : - rm -rf criu - git clone -b v$(CRIU_VERSION) https://github.com/checkpoint-restore/criu.git - pushd criu - RUNDIR=/run/criu make - sudo checkinstall --default --install=no --fstrans=no --pkgversion=$(CRIU_VERSION) --maintainer='@' --requires=$(CRIU_DEPS) --pakdir=$(DEST) diff --git a/platform/mellanox/docker-syncd-mlnx-rpc.mk b/platform/mellanox/docker-syncd-mlnx-rpc.mk index b11c5a8c0d51..fc0f6239d548 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc.mk +++ b/platform/mellanox/docker-syncd-mlnx-rpc.mk @@ -2,7 +2,7 @@ DOCKER_SYNCD_MLNX_RPC = docker-syncd-mlnx-rpc.gz $(DOCKER_SYNCD_MLNX_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-mlnx-rpc -$(DOCKER_SYNCD_MLNX_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) $(MLNX_SFPD) $(MLNX_ISSU) +$(DOCKER_SYNCD_MLNX_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) $(MLNX_SFPD) $(DOCKER_SYNCD_MLNX_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_MLNX) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX_RPC) ifeq ($(ENABLE_SYNCD_RPC),y) diff --git a/platform/mellanox/docker-syncd-mlnx.mk b/platform/mellanox/docker-syncd-mlnx.mk index dd11f32f7122..da217492d438 100644 --- a/platform/mellanox/docker-syncd-mlnx.mk +++ b/platform/mellanox/docker-syncd-mlnx.mk @@ -2,7 +2,7 @@ DOCKER_SYNCD_MLNX = docker-syncd-mlnx.gz $(DOCKER_SYNCD_MLNX)_PATH = $(PLATFORM_PATH)/docker-syncd-mlnx -$(DOCKER_SYNCD_MLNX)_DEPENDS += $(SYNCD) $(PYTHON_SDK_API) $(MLNX_SFPD) $(CRIU) $(MLNX_ISSU) +$(DOCKER_SYNCD_MLNX)_DEPENDS += $(SYNCD) $(PYTHON_SDK_API) $(MLNX_SFPD) $(DOCKER_SYNCD_MLNX)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX) ifneq ($(ENABLE_SYNCD_RPC),y) @@ -14,4 +14,4 @@ $(DOCKER_SYNCD_MLNX)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_MLNX)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_MLNX)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_SYNCD_MLNX)_RUN_OPT += -v /host/warmboot:/var/warmboot -$(DOCKER_SYNCD_MLNX)_RUN_OPT += --tmpfs /run/criu + diff --git a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 index bf301f179a42..971602a212f0 100755 --- a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 @@ -14,7 +14,7 @@ debs/{{ deb }}{{' '}} {%- endfor -%} debs/ -RUN apt-get install -y --no-install-recommends libxml2 iptables libbsd0 protobuf-c-compiler protobuf-compiler python-protobuf libprotobuf-c1 python-future python-ipaddr libnet1 pkg-config asciidoc xmlto +RUN apt-get install -y libxml2 RUN dpkg -i \ {% for deb in docker_syncd_mlnx_debs.split(' ') -%} diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index 99414ff9459a..48f86cc05e78 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -1,6 +1,6 @@ # mellanox firmware -MLNX_FW_VERSION = 13.1910.0906 +MLNX_FW_VERSION = 13.1910.0920 MLNX_FW_FILE = fw-SPC-rel-$(subst .,_,$(MLNX_FW_VERSION))-EVB.mfa $(MLNX_FW_FILE)_URL = $(MLNX_SDK_BASE_URL)/$(MLNX_FW_FILE) SONIC_ONLINE_FILES += $(MLNX_FW_FILE) diff --git a/platform/mellanox/hw-management/hw-mgmt b/platform/mellanox/hw-management/hw-mgmt index 344e81942c02..498002ba528e 160000 --- a/platform/mellanox/hw-management/hw-mgmt +++ b/platform/mellanox/hw-management/hw-mgmt @@ -1 +1 @@ -Subproject commit 344e81942c02c279db03c3aba40db4142dc6817d +Subproject commit 498002ba528e5633bf1e9b8e488979ed731ca0f6 diff --git a/platform/mellanox/issu-version.mk b/platform/mellanox/issu-version.mk new file mode 100644 index 000000000000..c7ae4296ab7a --- /dev/null +++ b/platform/mellanox/issu-version.mk @@ -0,0 +1,9 @@ +# ISSU version + +ISSU_VERSION_FILE = issu-version +$(ISSU_VERSION_FILE)_SRC_PATH = $(PLATFORM_PATH)/issu-version +$(ISSU_VERSION_FILE)_DEPENDS += $(APPLIBS) +SONIC_MAKE_FILES += $(ISSU_VERSION_FILE) + +export ISSU_VERSION_FILE + diff --git a/platform/mellanox/issu-version/Makefile b/platform/mellanox/issu-version/Makefile new file mode 100644 index 000000000000..1f7d7fba3a3f --- /dev/null +++ b/platform/mellanox/issu-version/Makefile @@ -0,0 +1,12 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = issu-version + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + sx_sdk --version | egrep -o 'ISSU [0-9]+' > $(DEST)/$(MAIN_TARGET) || { + echo "ISSU version is undefined: $(sx_sdk --version)" + rm $(DEST)/$(MAIN_TARGET) + exit 1 + } diff --git a/platform/mellanox/mlnx-ffb.sh b/platform/mellanox/mlnx-ffb.sh index c87ea56f08f5..1488bb2c6b97 100755 --- a/platform/mellanox/mlnx-ffb.sh +++ b/platform/mellanox/mlnx-ffb.sh @@ -37,21 +37,31 @@ check_sdk_upgrade() mkdir -p "${FS_MOUNTPOINT}" mount -t squashfs "${FS_PATH}" "${FS_MOUNTPOINT}" || { >&2 echo "Failed to mount next SONiC image" - break; + break } - SDK_VERSION_FILE_PATH="${FS_MOUNTPOINT}/etc/mlnx/sdk-version" + ISSU_VERSION_FILE_PATH="/etc/mlnx/issu-version" - [ -f "${SDK_VERSION_FILE_PATH}" ] && { - NEXT_SDK_VERSION="$(cat ${FS_MOUNTPOINT}/etc/mlnx/sdk-version)" - } || { - >&2 echo "No SDK version file ${SDK_VERSION_FILE_PATH}" - break; + [ -f "${ISSU_VERSION_FILE_PATH}" ] || { + >&2 echo "No ISSU version file found ${ISSU_VERSION_FILE_PATH}" + break } - ISSU_CHECK_CMD="docker exec -t syncd issu --check ${NEXT_SDK_VERSION}" + [ -f "${FS_MOUNTPOINT}/${ISSU_VERSION_FILE_PATH}" ] || { + >&2 echo "No ISSU version file found ${ISSU_VERSION_FILE_PATH} in ${NEXT_SONIC_IMAGE}" + break + } + + CURRENT_ISSU_VERSION="$(cat ${ISSU_VERSION_FILE_PATH})" + NEXT_ISSU_VERSION="$(cat ${FS_MOUNTPOINT}/${ISSU_VERSION_FILE_PATH})" - ${ISS_CHECK_CMD} > /dev/null && CHECK_RESULT="${FFB_SUCCESS}" + if [[ "${CURRENT_ISSU_VERSION}" == "${NEXT_ISSU_VERSION}" ]]; then + CHECK_RESULT="${FFB_SUCCESS}" + else + >&2 echo "Current and next ISSU version do not match:" + >&2 echo "Current ISSU version: ${CURRENT_ISSU_VERSION}" + >&2 echo "Next ISSU version: ${NEXT_ISSU_VERSION}" + fi break done @@ -65,34 +75,15 @@ check_sdk_upgrade() check_ffb() { check_issu_enabled || { - echo "ISSU is not enabled on this HWSKU" + >&2 echo "ISSU is not enabled on this HWSKU" return "${FFB_FAILURE}" } + check_sdk_upgrade || { - echo "SDK upgrade check failued" + >&2 echo "SDK upgrade check failued" return "${FFB_FAILURE}" } - return "${FFB_SUCCESS}"; -} - -# Perform ISSU start -issu_start() -{ - ISSU_START_CMD="docker exec -t syncd issu --start" - ${ISSU_START_CMD} > /dev/null - EXIT_CODE=$? - - return $EXIT_CODE + return "${FFB_SUCCESS}" } -# Perform ISSU end -issu_end() -{ - ISSU_END_CMD="docker exec -t syncd issu --end" - ${ISSU_END_CMD} > /dev/null - - EXIT_CODE=$? - - return $EXIT_CODE -} diff --git a/platform/mellanox/mlnx-issu.mk b/platform/mellanox/mlnx-issu.mk deleted file mode 100755 index f0e3b47050ac..000000000000 --- a/platform/mellanox/mlnx-issu.mk +++ /dev/null @@ -1,5 +0,0 @@ -# issu (SONiC MLNX platform ISSU tool) Debian package - -MLNX_ISSU = python-mlnx-issu_1.0-1_all.deb -$(MLNX_ISSU)_SRC_PATH = $(PLATFORM_PATH)/mlnx-issu -SONIC_PYTHON_STDEB_DEBS += $(MLNX_ISSU) diff --git a/platform/mellanox/mlnx-issu/scripts/issu b/platform/mellanox/mlnx-issu/scripts/issu deleted file mode 100755 index 45c0f50436c7..000000000000 --- a/platform/mellanox/mlnx-issu/scripts/issu +++ /dev/null @@ -1,176 +0,0 @@ -#!/usr/bin/env python -''' -This code is for a mlnx platform specific tool, issu. -This tool provides an CLI interface to interact with SDK ISSU module -''' - -from __future__ import print_function - -import sys -import os -import re -import errno -import syslog -import argparse - -from functools import wraps - -from python_sdk_api import sx_api - -# ========================== Constants =============================== -SDK_VERSION_PATTERN = r'(\d+)\.(\d+)\.(.*)' -SYSLOG_IDENTIFIER = "ISSU" - - -# Flag that indicates whether to print logs to stdout -verbose = False - - -# ========================== Syslog wrappers ========================== -def log_info(msg): - syslog.openlog(SYSLOG_IDENTIFIER) - syslog.syslog(syslog.LOG_INFO, msg) - syslog.closelog() - - if verbose: - print(msg) - -def log_warning(msg): - syslog.openlog(SYSLOG_IDENTIFIER) - syslog.syslog(syslog.LOG_WARNING, msg) - syslog.closelog() - - if verbose: - print(msg) - -def log_error(msg): - syslog.openlog(SYSLOG_IDENTIFIER) - syslog.syslog(syslog.LOG_ERR, msg) - syslog.closelog() - - print(msg, file=sys.stderr) - - -# ========================== Global functions ========================= -def with_sdk_handle(func): - """ A decorator for @func that use sx api - that gets a SDK handler, calls func(handler, *args, **kwargs) - and then closes the handler regardless of func failure""" - - @wraps(func) - def wrapped(*args, **kwargs): - log_info("opening sdk") - rc, handle = sx_api.sx_api_open(None) - log_info("sx_api_open handle: 0x%x , rc %d " % ( handle, rc) ) - - if rc != sx_api.SX_STATUS_SUCCESS: - log_error("failed to open api handle. Please check that SDK is running") - sys.exit(errno.EACCES) - - try: - res = func(handle, *args, **kwargs) - finally: - log_info("closing sdk handle") - rc = sx_api.sx_api_close(handle) - - if rc != sx_api.SX_STATUS_SUCCESS: - log_error("failed to close api handle") - - return res - - return wrapped - - -def check_sdk_version_pattern(sdk_version): - """Checker for @sdk_version""" - - if not re.match(SDK_VERSION_PATTERN, sdk_version): - raise argparse.ArgumentTypeError("{} is an invalid SDK version string".format(sdk_version)) - - return sdk_version - - -@with_sdk_handle -def check_issu_upgrade_to_sdk_version(handle, new_sdk): - """This function checks whether ISSU upgrade to @new_sdk version is posible""" - - version = sx_api.new_sx_api_sx_sdk_versions_t_p() - rc = sx_api.sx_api_sx_sdk_version_get(handle, version) - - if rc != sx_api.SX_STATUS_SUCCESS: - log_error("failed to get current SDK version") - sys.exit(errno.EACCES) - - current_sdk = version.sx_sdk - - succeed = True - - log_info('check ISSU upgrade: current SDK: {}, new SDK: {}, check succeed: {}'.format(current_sdk, new_sdk, succeed)) - - return succeed - - -@with_sdk_handle -def issu_start(handle): - """This function calls ISSU start API""" - - log_info("call ISSU start") - rc = sx_api.sx_api_issu_start_set(handle) - - if rc != sx_api.SX_STATUS_SUCCESS: - log_error("failed to execute ISSU start API") - sys.exit(errno.EACCES) - -@with_sdk_handle -def issu_end(handle): - """This function calls ISSU end API""" - - log_info("call ISSU end") - rc = sx_api.sx_api_issu_end_set(handle) - - if rc != sx_api.SX_STATUS_SUCCESS: - log_error("failed to execute ISSU end API") - sys.exit(errno.EACCES) - - -def get_parser(): - """This function creates an argument parser""" - - parser = argparse.ArgumentParser() - parser.add_argument('-c', '--check', nargs=1, action='store', default=None, type=check_sdk_version_pattern, - help='Check if ISSU upgrade is supported to new SDK version') - parser.add_argument('-s', '--start', action='store_true', help='Call ISSU start API') - parser.add_argument('-e', '--end', action='store_true', help='Call ISSU end API') - parser.add_argument('-v', '--verbose', action='store_true', default=False) - - return parser - - -def main(): - - global verbose - - parser = get_parser() - args = parser.parse_args() - - verbose = args.verbose - - if args.check is not None: - new_sdk = args.check[0] - is_supported = check_issu_upgrade_to_sdk_version(new_sdk) - - if verbose: - print('SDK upgrade is{}supported'.format(' ' if is_supported else ' not ')) - - if not is_supported: - sys.exit(1) - elif args.start: - issu_start() - elif args.end: - issu_end() - else: - parser.parse_args(['-h']) - - -if __name__ == '__main__': - main() diff --git a/platform/mellanox/mlnx-issu/setup.py b/platform/mellanox/mlnx-issu/setup.py deleted file mode 100755 index 614c9a0bbe46..000000000000 --- a/platform/mellanox/mlnx-issu/setup.py +++ /dev/null @@ -1,14 +0,0 @@ -from setuptools import setup - -setup( - name='mlnx-issu', - version='1.0', - description='MLNX ISSU tool for SONiC on mellanox platform', - author='SONiC Community', - url='https://github.com/Azure/sonic-buildimage/', - maintainer='Stepan Blyschak', - maintainer_email='stepanb@mellanox.com', - scripts=[ - 'scripts/issu', - ] -) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index d5d3d53830a4..d5f242728d3b 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI -MLNX_SAI_VERSION = SAIRel1.13.3-master -MLNX_SAI_REVISION = 7cc737246fce514372cf8fd447360c5f11e7c8b9 +MLNX_SAI_VERSION = SAIRel1.13.4-master +MLNX_SAI_REVISION = 783d040465fb31771bcb9ec3d655d053e88b1bf0 export MLNX_SAI_VERSION MLNX_SAI_REVISION diff --git a/platform/mellanox/one-image.mk b/platform/mellanox/one-image.mk index 3a99f1c66c80..6fd5af193276 100644 --- a/platform/mellanox/one-image.mk +++ b/platform/mellanox/one-image.mk @@ -5,5 +5,5 @@ $(SONIC_ONE_IMAGE)_MACHINE = mellanox $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie $(SONIC_ONE_IMAGE)_INSTALLS += $(SX_KERNEL) $(KERNEL_MFT) $(MFT_OEM) $(MFT) $(MLNX_HW_MANAGEMENT) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) -$(SONIC_ONE_IMAGE)_FILES += $(MLNX_FW_FILE) $(MLNX_FFB_SCRIPT) +$(SONIC_ONE_IMAGE)_FILES += $(MLNX_FW_FILE) $(MLNX_FFB_SCRIPT) $(ISSU_VERSION_FILE) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk index 28414b7f9d9f..1c0072bec3ce 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -12,7 +12,7 @@ include $(PLATFORM_PATH)/libsaithrift-dev.mk include $(PLATFORM_PATH)/docker-ptf-mlnx.mk include $(PLATFORM_PATH)/mlnx-sfpd.mk include $(PLATFORM_PATH)/mlnx-ffb.mk -include $(PLATFORM_PATH)/mlnx-issu.mk +include $(PLATFORM_PATH)/issu-version.mk SONIC_ALL += $(SONIC_ONE_IMAGE) \ $(DOCKER_FPM) diff --git a/platform/mellanox/sdk-version.j2 b/platform/mellanox/sdk-version.j2 deleted file mode 100755 index 5bba188430d6..000000000000 --- a/platform/mellanox/sdk-version.j2 +++ /dev/null @@ -1 +0,0 @@ -{{ MLNX_SDK_VERSION }} \ No newline at end of file diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index c7ca2a513072..c9aed71fdc57 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -1,5 +1,5 @@ -MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/543d9e8b5e8c6c58805b3579a0d9d4796d496812/sdk -MLNX_SDK_VERSION = 4.3.0132 +MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/f3e389f1ba9535fdd6afb134897683b65d1ad4e7/sdk +MLNX_SDK_VERSION = 4.3.0136 MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2_MLNX) $(SX_ACL_RM) $(SX_COMPLIB) \ $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \ $(SXD_LIBS) $(TESTX) @@ -56,4 +56,3 @@ $(eval $(foreach deb,$(PYTHON_SDK_API) $(SX_KERNEL) $(SX_KERNEL_DEV),$(call make SONIC_ONLINE_DEBS += $(MLNX_SDK_RDEBS) $(PYTHON_SDK_API) $(SX_KERNEL) -export MLNX_SDK_VERSION diff --git a/platform/p4/docker-sonic-p4/rsyslog.conf b/platform/p4/docker-sonic-p4/rsyslog.conf index 79926a8b30c7..27e046257e18 100644 --- a/platform/p4/docker-sonic-p4/rsyslog.conf +++ b/platform/p4/docker-sonic-p4/rsyslog.conf @@ -14,6 +14,13 @@ ################# $ModLoad imuxsock # provides support for local system logging + +# +# Set a rate limit on messages from the container +# +$SystemLogRateLimitInterval 300 +$SystemLogRateLimitBurst 20000 + #$ModLoad imklog # provides kernel logging support #$ModLoad immark # provides --MARK-- message capability diff --git a/platform/vs/docker-sonic-vs/start.sh b/platform/vs/docker-sonic-vs/start.sh index 3871dc375ff5..b13f5febff3a 100755 --- a/platform/vs/docker-sonic-vs/start.sh +++ b/platform/vs/docker-sonic-vs/start.sh @@ -50,6 +50,8 @@ supervisorctl start fpmsyncd supervisorctl start teammgrd +supervisorctl start vrfmgrd + supervisorctl start portmgrd supervisorctl start intfmgrd @@ -60,8 +62,6 @@ supervisorctl start zebra supervisorctl start buffermgrd -supervisorctl start vrfmgrd - supervisorctl start nbrmgrd # Start arp_update when VLAN exists diff --git a/rules/config b/rules/config index 86139c71540f..674280a3ca2c 100644 --- a/rules/config +++ b/rules/config @@ -84,3 +84,6 @@ DEFAULT_KERNEL_PROCURE_METHOD = build # group during installation. FRR_USER_UID = 1000 FRR_USER_GID = 1000 + +# Default VS build memory preparation +DEFAULT_VS_PREPARE_MEM = yes diff --git a/rules/docker-router-advertiser.mk b/rules/docker-router-advertiser.mk index 129246d8fa2d..c77ce03d6520 100644 --- a/rules/docker-router-advertiser.mk +++ b/rules/docker-router-advertiser.mk @@ -2,6 +2,7 @@ DOCKER_ROUTER_ADVERTISER = docker-router-advertiser.gz $(DOCKER_ROUTER_ADVERTISER)_PATH = $(DOCKERS_PATH)/docker-router-advertiser +$(DOCKER_ROUTER_ADVERTISER)_DEPENDS += $(REDIS_TOOLS) $(DOCKER_ROUTER_ADVERTISER)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_ROUTER_ADVERTISER) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ROUTER_ADVERTISER) diff --git a/rules/quagga.mk b/rules/quagga.mk index f4ba4f2d0be8..353cd5e3fac2 100644 --- a/rules/quagga.mk +++ b/rules/quagga.mk @@ -1,6 +1,11 @@ # quagga package -QUAGGA = quagga_0.99.24.1-2.1_amd64.deb +QUAGGA_VERSION_FULL = 0.99.24.1-2.1 + +QUAGGA = quagga_$(QUAGGA_VERSION_FULL)_amd64.deb $(QUAGGA)_DEPENDS += $(LIBSNMP_DEV) $(QUAGGA)_SRC_PATH = $(SRC_PATH)/sonic-quagga SONIC_DPKG_DEBS += $(QUAGGA) + +QUAGGA_DBG = quagga-dbg_$(QUAGGA_VERSION_FULL)_amd64.deb +$(eval $(call add_derived_package,$(QUAGGA),$(QUAGGA_DBG))) diff --git a/slave.mk b/slave.mk index 93811b43371c..b4b7f8de1f92 100644 --- a/slave.mk +++ b/slave.mk @@ -109,6 +109,10 @@ ifeq ($(SONIC_BUILD_JOBS),) override SONIC_BUILD_JOBS := $(SONIC_CONFIG_BUILD_JOBS) endif +ifeq ($(VS_PREPARE_MEM),) +override VS_PREPARE_MEM := $(DEFAULT_VS_PREPARE_MEM) +endif + ifeq ($(KERNEL_PROCURE_METHOD),) override KERNEL_PROCURE_METHOD := $(DEFAULT_KERNEL_PROCURE_METHOD) endif @@ -155,6 +159,7 @@ $(info "SONIC_DEBUGGING_ON" : "$(SONIC_DEBUGGING_ON)") $(info "SONIC_PROFILING_ON" : "$(SONIC_PROFILING_ON)") $(info "KERNEL_PROCURE_METHOD" : "$(KERNEL_PROCURE_METHOD)") $(info "BUILD_TIMESTAMP" : "$(BUILD_TIMESTAMP)") +$(info "VS_PREPARE_MEM" : "$(VS_PREPARE_MEM)") $(info ) ############################################################################### @@ -163,6 +168,7 @@ $(info ) ############################################################################### export kernel_procure_method=$(KERNEL_PROCURE_METHOD) +export vs_build_prepare_mem=$(VS_PREPARE_MEM) ############################################################################### ## Local targets diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index 08a7c6bf053a..368f1bdfe3b1 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -2,11 +2,13 @@ FROM debian:jessie MAINTAINER johnar@microsoft.com +## Remove retired jessie-updates repo +RUN sed -i '/deb http:\/\/deb.debian.org\/debian jessie-updates main/d' /etc/apt/sources.list + RUN echo "deb http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-free" >> /etc/apt/sources.list && \ echo "deb-src http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-free" >> /etc/apt/sources.list && \ echo "deb http://debian-archive.trafficmanager.net/debian-security/ jessie/updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb-src http://debian-archive.trafficmanager.net/debian-security/ jessie/updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb http://debian-archive.trafficmanager.net/debian/ jessie-backports main contrib non-free" >> /etc/apt/sources.list + echo "deb-src http://debian-archive.trafficmanager.net/debian-security/ jessie/updates main contrib non-free" >> /etc/apt/sources.list ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive @@ -232,19 +234,6 @@ RUN apt-get update && apt-get install -y \ texi2html \ # For initramfs bash-completion \ -# For Mellanox CRIU build - libprotobuf-dev \ - libprotobuf-c0-dev \ - protobuf-c-compiler \ - protobuf-compiler \ - python-protobuf \ - pkg-config \ - libnet1-dev \ - libnet-dev \ - libaio-dev \ - asciidoc \ - xmlto \ - checkinstall \ # For sonic vs image build dosfstools \ qemu-kvm \ @@ -278,7 +267,7 @@ RUN pip install --force-reinstall --upgrade jinja2>=2.10 RUN pip install j2cli # For sonic utilities testing -RUN pip install click-default-group click natsort tabulate netifaces==0.10.7 +RUN pip install click-default-group click natsort tabulate netifaces==0.10.7 fastentrypoints # For supervisor build RUN pip install meld3 mock diff --git a/src/libteam/0006-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch b/src/libteam/0006-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch new file mode 100644 index 000000000000..bab3a9108325 --- /dev/null +++ b/src/libteam/0006-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch @@ -0,0 +1,45 @@ +From 9a27e9b85afbbf6235e61c2426481e49a2139219 Mon Sep 17 00:00:00 2001 +From: Shu0T1an ChenG +Date: Tue, 15 Jan 2019 12:23:02 -0800 +Subject: [PATCH] Fix ifinfo_link_with_port race condition with newlink + +The race condition could happen like this: +When an interface is enslaved into the port channel immediately after +it is created, the order of creating the ifinfo and linking the ifinfo to +the port is not guaranteed. + +The team handler will listen to both netlink message to track new links +get created to allocate the ifinfo and add the ifinfo into its linked list, +and the team port change message to link the new port with ifinfo found +in its linkedin list. However, when the ifinfo is not yet created, the error +message "Failed to link port with ifinfo" is thrown with member port failed +to be added into the team handler's port list. + +This fix adds a condition to check if ifinfo_link_with_port is linking ifinfo +to a port or to the team interface itself. If it is a port, ifinfo_find_create +function is used to fix the race condition. + +Signed-off-by: Shu0T1an ChenG +--- + libteam/ifinfo.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/libteam/ifinfo.c b/libteam/ifinfo.c +index 44de4ca..444e0cd 100644 +--- a/libteam/ifinfo.c ++++ b/libteam/ifinfo.c +@@ -429,7 +429,10 @@ int ifinfo_link_with_port(struct team_handle *th, uint32_t ifindex, + { + struct team_ifinfo *ifinfo; + +- ifinfo = ifinfo_find(th, ifindex); ++ if (port) ++ ifinfo = ifinfo_find_create(th, ifindex); ++ else ++ ifinfo = ifinfo_find(th, ifindex); + if (!ifinfo) + return -ENOENT; + if (ifinfo->linked) +-- +2.1.4 + diff --git a/src/libteam/0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch b/src/libteam/0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch new file mode 100644 index 000000000000..8a59756bb02b --- /dev/null +++ b/src/libteam/0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch @@ -0,0 +1,36 @@ +From 43e512b114176feb1828ff0a75f0224f2b219a2d Mon Sep 17 00:00:00 2001 +From: Jipan Yang +Date: Sun, 24 Feb 2019 00:04:15 -0800 +Subject: [PATCH] Skip setting the same hwaddr to lag port to avoid disrupting + neighbor entries + +Signed-off-by: Jipan Yang +--- + teamd/teamd.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/teamd/teamd.c b/teamd/teamd.c +index 225b8c8..e28aa7d 100644 +--- a/teamd/teamd.c ++++ b/teamd/teamd.c +@@ -866,7 +866,16 @@ static int teamd_set_hwaddr(struct teamd_context *ctx) + err = -EINVAL; + goto free_hwaddr; + } +- err = team_hwaddr_set(ctx->th, ctx->ifindex, hwaddr, hwaddr_len); ++ ++ if(!memcmp(hwaddr, ctx->hwaddr, hwaddr_len)) ++ { ++ err = 0; ++ teamd_log_dbg("Skip setting same hwaddr string: \"%s\".", hwaddr_str); ++ } ++ else ++ { ++ err = team_hwaddr_set(ctx->th, ctx->ifindex, hwaddr, hwaddr_len); ++ } + if (!err) + ctx->hwaddr_explicit = true; + free_hwaddr: +-- +2.9.2 + diff --git a/src/libteam/0008-teamd-register-change-handler-for-TEAM_IFINFO_CHANGE.patch b/src/libteam/0008-teamd-register-change-handler-for-TEAM_IFINFO_CHANGE.patch new file mode 100644 index 000000000000..a603f91f62fe --- /dev/null +++ b/src/libteam/0008-teamd-register-change-handler-for-TEAM_IFINFO_CHANGE.patch @@ -0,0 +1,34 @@ +From 7dff9798c2c92eb75b0120737efb81febcdb80c1 Mon Sep 17 00:00:00 2001 +From: Ying Xie +Date: Sun, 24 Mar 2019 21:49:59 +0000 +Subject: [PATCH] [teamd] register change handler for TEAM_IFINFO_CHANGE as + well + +There has been a race condition in the libnal/teamd interation, causing +TEAM_PORT_CHANGE to report a port with empty device name. Which then +causes the teamd unable to add the lag members into the lag. + +Registering to the TEAM_IFINFO_CHANGE would give teamd another chance to +add member again. + +Signed-off-by: Ying Xie +--- + teamd/teamd_per_port.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/teamd/teamd_per_port.c b/teamd/teamd_per_port.c +index 09d1dc7..137da57 100644 +--- a/teamd/teamd_per_port.c ++++ b/teamd/teamd_per_port.c +@@ -274,7 +274,7 @@ static int port_priv_change_handler_func(struct team_handle *th, void *priv, + + static const struct team_change_handler port_priv_change_handler = { + .func = port_priv_change_handler_func, +- .type_mask = TEAM_PORT_CHANGE, ++ .type_mask = TEAM_PORT_CHANGE | TEAM_IFINFO_CHANGE, + }; + + int teamd_per_port_init(struct teamd_context *ctx) +-- +2.7.4 + diff --git a/src/libteam/0009-teamd-prevent-private-change-handler-reentrance.patch b/src/libteam/0009-teamd-prevent-private-change-handler-reentrance.patch new file mode 100644 index 000000000000..dad10a4c1ae9 --- /dev/null +++ b/src/libteam/0009-teamd-prevent-private-change-handler-reentrance.patch @@ -0,0 +1,90 @@ +From fb00b070482dc587eec7b4e34acec094be1af00d Mon Sep 17 00:00:00 2001 +From: Ying Xie +Date: Fri, 29 Mar 2019 20:54:49 +0000 +Subject: [PATCH 10/11] [teamd] prevent private change handler reentrance + +While handling PORT_CHANGE, teamd could casue an INTERFACE_CHANGE in the +same context. Which will interfere with the PORT_CHANGE handling and +causing it to fail. + +Lock is not needed because the re-entrance happened in the same thread +context. + +This issue was noticed while dynamically adding a port into a lag. + +Signed-off-by: Ying Xie +--- + teamd/teamd.c | 2 ++ + teamd/teamd.h | 2 ++ + teamd/teamd_per_port.c | 13 +++++++++++-- + 3 files changed, 15 insertions(+), 2 deletions(-) + +diff --git a/teamd/teamd.c b/teamd/teamd.c +index e28aa7d..140b98b 100644 +--- a/teamd/teamd.c ++++ b/teamd/teamd.c +@@ -1255,6 +1255,8 @@ static int teamd_init(struct teamd_context *ctx) + { + int err; + ++ ctx->reentrant = false; ++ + ctx->th = team_alloc(); + if (!ctx->th) { + teamd_log_err("Team alloc failed."); +diff --git a/teamd/teamd.h b/teamd/teamd.h +index 622c365..7cd3266 100644 +--- a/teamd/teamd.h ++++ b/teamd/teamd.h +@@ -160,6 +160,8 @@ struct teamd_context { + int pipe_r; + int pipe_w; + } workq; ++ ++ bool reentrant; + }; + + struct teamd_port { +diff --git a/teamd/teamd_per_port.c b/teamd/teamd_per_port.c +index 137da57..8b4a457 100644 +--- a/teamd/teamd_per_port.c ++++ b/teamd/teamd_per_port.c +@@ -250,6 +250,10 @@ static int port_priv_change_handler_func(struct team_handle *th, void *priv, + struct port_obj *port_obj; + int err; + ++ if (ctx->reentrant) { ++ return 0; ++ } ++ ctx->reentrant = true; + team_for_each_port(port, th) { + uint32_t ifindex = team_get_port_ifindex(port); + +@@ -258,17 +262,22 @@ static int port_priv_change_handler_func(struct team_handle *th, void *priv, + if (team_is_port_removed(port)) + continue; + err = port_obj_create(ctx, &port_obj, ifindex, port); +- if (err) ++ if (err) { ++ ctx->reentrant = false; + return err; ++ } + } + if (team_is_port_changed(port)) { + err = teamd_event_port_changed(ctx, _port(port_obj)); +- if (err) ++ if (err) { ++ ctx->reentrant = false; + return err; ++ } + } + if (team_is_port_removed(port)) + port_obj_remove(ctx, port_obj); + } ++ ctx->reentrant = false; + return 0; + } + +-- +2.7.4 + diff --git a/src/libteam/Makefile b/src/libteam/Makefile index 50ad002c50c6..256680d34943 100644 --- a/src/libteam/Makefile +++ b/src/libteam/Makefile @@ -12,14 +12,11 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : rm -rf ./libteam git clone https://github.com/jpirko/libteam.git pushd ./libteam - git checkout -f v1.26 + git checkout -b teamd -f v1.26 - # Apply patch - git apply ../0001-libteam-Add-team_get_port_enabled-function.patch - git apply ../0002-libteam-Temporarily-remove-redundant-debug-mes.patch - git apply ../0003-teamd-lacp-runner-will-send-lacp-update-right-after-.patch - git apply ../0004-libteam-Add-lacp-fallback-support-for-single-member-.patch - git apply ../0005-libteam-Add-warm_reboot-mode.patch + # Apply patch series + stg init + stg import -s ../series popd # Obtain debian packaging diff --git a/src/libteam/series b/src/libteam/series new file mode 100644 index 000000000000..a6c4893d021a --- /dev/null +++ b/src/libteam/series @@ -0,0 +1,9 @@ +0001-libteam-Add-team_get_port_enabled-function.patch +0002-libteam-Temporarily-remove-redundant-debug-mes.patch +0003-teamd-lacp-runner-will-send-lacp-update-right-after-.patch +0004-libteam-Add-lacp-fallback-support-for-single-member-.patch +0005-libteam-Add-warm_reboot-mode.patch +0006-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch +0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch +0008-teamd-register-change-handler-for-TEAM_IFINFO_CHANGE.patch +0009-teamd-prevent-private-change-handler-reentrance.patch diff --git a/src/sonic-config-engine/config_samples.py b/src/sonic-config-engine/config_samples.py index 6cb417b9a50b..adaea0c4532c 100644 --- a/src/sonic-config-engine/config_samples.py +++ b/src/sonic-config-engine/config_samples.py @@ -47,6 +47,8 @@ def generate_l2_config(data): if not data['DEVICE_METADATA']['localhost'].has_key('type'): data['DEVICE_METADATA']['localhost']['type'] = 'ToRRouter' data['VLAN'] = {'Vlan1000': {'vlanid': '1000'}} + vp = natsorted(data['PORT'].keys()) + data['VLAN']['Vlan1000'].setdefault('members', vp) data['VLAN_MEMBER'] = {} for port in natsorted(data['PORT'].keys()): data['VLAN_MEMBER']['Vlan1000|{}'.format(port)] = {'tagging_mode': 'untagged'} diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 138a61a00a66..9ab3d0f02be5 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -530,6 +530,7 @@ def parse_xml(filename, platform=None, port_config_file=None): if port.get('speed') == '100000': port['fec'] = 'rs' + # set port description if parsed from deviceinfo for port_name in port_descriptions: # ignore port not in port_config.ini if not ports.has_key(port_name): @@ -537,10 +538,23 @@ def parse_xml(filename, platform=None, port_config_file=None): ports.setdefault(port_name, {})['description'] = port_descriptions[port_name] + for port_name, port in ports.items(): + if not port.get('description'): + if neighbors.has_key(port_name): + # for the ports w/o description set it to neighbor name:port + port['description'] = "%s:%s" % (neighbors[port_name]['name'], neighbors[port_name]['port']) + else: + # for the ports w/o neighbor info, set it to port alias + port['description'] = port.get('alias', port_name) + # set default port MTU as 9100 for port in ports.itervalues(): port['mtu'] = '9100' + # asymmetric PFC is disabled by default + for port in ports.itervalues(): + port['pfc_asym'] = 'off' + # set physical port default admin status up for port in phyport_intfs: if port[0] in ports: diff --git a/src/sonic-config-engine/tests/sample_output/buffers-dell6100.json b/src/sonic-config-engine/tests/sample_output/buffers-dell6100.json index 6552f6225737..0b6c8cbe19a3 100644 --- a/src/sonic-config-engine/tests/sample_output/buffers-dell6100.json +++ b/src/sonic-config-engine/tests/sample_output/buffers-dell6100.json @@ -71,13 +71,13 @@ "BUFFER_POOL": { "ingress_lossless_pool": { - "size": "11213696", + "size": "10875072", "type": "ingress", "mode": "dynamic", - "xoff": "3855488" + "xoff": "4194112" }, "egress_lossy_pool": { - "size": "9532224", + "size": "9243812", "type": "egress", "mode": "dynamic" }, @@ -105,10 +105,7 @@ } }, "BUFFER_PG": { - "Ethernet0,Ethernet1,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet48,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58|0-1": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet0,Ethernet1,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet48,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58|5": { + "Ethernet0,Ethernet1,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet48,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" } }, @@ -117,10 +114,10 @@ "Ethernet0,Ethernet1,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet48,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58|3-4": { "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" }, - "Ethernet0,Ethernet1,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet48,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58|0-1": { + "Ethernet0,Ethernet1,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet48,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58|0-2": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" }, - "Ethernet0,Ethernet1,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet48,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58|5": { + "Ethernet0,Ethernet1,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet48,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58|5-6": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" } } diff --git a/src/sonic-config-engine/tests/sample_output/lldpd.conf b/src/sonic-config-engine/tests/sample_output/lldpd.conf index 29739cb890d0..d28ec8418362 100644 --- a/src/sonic-config-engine/tests/sample_output/lldpd.conf +++ b/src/sonic-config-engine/tests/sample_output/lldpd.conf @@ -1,2 +1,3 @@ configure ports eth0 lldp portidsubtype local eth0 - +configure system ip management pattern 10.0.0.100 +configure system hostname switch-t0 diff --git a/src/sonic-config-engine/tests/sample_output/ports.json b/src/sonic-config-engine/tests/sample_output/ports.json index 62fe4bbb5ccd..36f5ad117c39 100644 --- a/src/sonic-config-engine/tests/sample_output/ports.json +++ b/src/sonic-config-engine/tests/sample_output/ports.json @@ -2,14 +2,14 @@ { "PORT_TABLE:Ethernet0": { "speed": "10000", - "description": "" + "description": "fortyGigE0/0" }, "OP": "SET" }, { "PORT_TABLE:Ethernet4": { "speed": "25000", - "description": "" + "description": "fortyGigE0/4" }, "OP": "SET" }, diff --git a/src/sonic-config-engine/tests/sample_output/qos-dell6100.json b/src/sonic-config-engine/tests/sample_output/qos-dell6100.json index 2d442ca2525e..0387e10dc2f2 100644 --- a/src/sonic-config-engine/tests/sample_output/qos-dell6100.json +++ b/src/sonic-config-engine/tests/sample_output/qos-dell6100.json @@ -2,12 +2,12 @@ "TC_TO_PRIORITY_GROUP_MAP": { "AZURE": { "0": "0", - "1": "1", - "2": "2", + "1": "0", + "2": "0", "3": "3", "4": "4", - "5": "5", - "6": "6", + "5": "0", + "6": "0", "7": "7" } }, @@ -37,76 +37,80 @@ }, "DSCP_TO_TC_MAP": { "AZURE": { - "0" : "0", - "1" : "0", - "2" : "0", + "0" : "1", + "1" : "1", + "2" : "1", "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", + "5" : "2", + "6" : "1", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "1", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", "46": "5", - "47": "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" + "47": "1", + "48": "6", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" } }, "SCHEDULER": { "scheduler.0": { "type" : "DWRR", - "weight": "20" + "weight": "14" + }, + "scheduler.1": { + "type" : "DWRR", + "weight": "15" } }, "PORT_QOS_MAP": { @@ -137,355 +141,355 @@ }, "QUEUE": { "Ethernet0|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet1|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet4|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet5|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet6|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet7|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet8|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet9|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet10|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet11|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet12|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet13|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet14|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet15|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet16|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet17|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet20|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet21|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet22|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet23|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet24|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet25|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet26|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet27|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet28|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet29|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet30|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet31|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet32|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet36|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet37|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet38|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet39|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet40|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet41|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet42|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet48|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet52|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet53|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet54|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet55|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet56|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet57|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet58|3": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet0|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet1|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet4|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet5|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet6|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet7|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet8|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet9|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet10|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet11|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet12|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet13|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet14|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet15|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet16|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet17|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet20|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet21|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet22|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet23|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet24|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet25|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet26|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet27|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet28|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet29|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet30|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet31|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet32|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet36|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet37|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet38|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet39|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet40|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet41|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet42|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet48|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet52|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet53|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet54|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet55|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet56|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet57|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet58|4": { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.1]", "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet0|0": { @@ -752,6 +756,138 @@ "Ethernet58|1": { "scheduler": "[SCHEDULER|scheduler.0]" }, + "Ethernet0|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet1|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet4|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet5|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet6|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet7|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet8|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet9|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet10|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet11|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet12|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet13|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet14|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet15|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet16|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet17|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet20|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet21|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet22|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet23|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet24|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet25|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet26|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet27|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet28|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet29|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet30|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet31|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet32|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet36|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet37|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet38|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet39|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet40|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet41|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet42|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet48|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet52|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet53|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet54|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet55|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet56|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet57|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet58|2": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, "Ethernet0|5": { "scheduler": "[SCHEDULER|scheduler.0]" }, @@ -883,6 +1019,138 @@ }, "Ethernet58|5": { "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet0|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet1|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet4|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet5|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet6|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet7|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet8|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet9|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet10|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet11|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet12|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet13|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet14|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet15|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet16|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet17|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet20|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet21|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet22|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet23|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet24|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet25|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet26|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet27|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet28|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet29|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet30|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet31|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet32|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet36|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet37|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet38|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet39|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet40|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet41|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet42|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet48|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet52|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet53|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet54|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet55|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet56|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet57|6": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet58|6": { + "scheduler": "[SCHEDULER|scheduler.0]" } } } diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index f4ac56807ec5..efaf686253f5 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -151,6 +151,11 @@ def test_minigraph_extra_neighbors(self): "'Ethernet112': {'name': 'ARISTA01T1', 'port': 'Ethernet1/1'}, " "'Ethernet120': {'name': 'ARISTA03T1', 'port': 'Ethernet1/1'}}") + def test_minigraph_port_description(self): + argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v "PORT[\'Ethernet124\']"' + output = self.run_script(argument) + self.assertEqual(output.strip(), "{'lanes': '101,102,103,104', 'description': 'ARISTA04T1:Ethernet1/1', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/124', 'admin_status': 'up'}") + def test_minigraph_bgp(self): argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v "BGP_NEIGHBOR[\'10.0.0.59\']"' output = self.run_script(argument) @@ -169,47 +174,48 @@ def test_minigraph_deployment_id(self): def test_minigraph_ethernet_interfaces(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "PORT[\'Ethernet8\']"' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'lanes': '37,38,39,40', 'description': 'Interface description', 'mtu': '9100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'speed': '1000'}") + self.assertEqual(output.strip(), "{'lanes': '37,38,39,40', 'description': 'Interface description', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'speed': '1000'}") argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "PORT[\'Ethernet12\']"' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'lanes': '33,34,35,36', 'description': 'Interface description', 'mtu': '9100', 'alias': 'fortyGigE0/12', 'speed': '100000', 'fec': 'rs'}") + self.assertEqual(output.strip(), "{'lanes': '33,34,35,36', 'fec': 'rs', 'mtu': '9100', 'alias': 'fortyGigE0/12', 'pfc_asym': 'off', 'speed': '100000', 'description': 'Interface description'}") def test_minigraph_extra_ethernet_interfaces(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "PORT"' output = self.run_script(argument) + self.assertEqual(output.strip(), \ - "{'Ethernet8': {'lanes': '37,38,39,40', 'description': 'Interface description', 'mtu': '9100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'speed': '1000'}, " - "'Ethernet0': {'alias': 'fortyGigE0/0', 'admin_status': 'up', 'lanes': '29,30,31,32', 'speed': '10000', 'mtu': '9100'}, " - "'Ethernet4': {'alias': 'fortyGigE0/4', 'admin_status': 'up', 'lanes': '25,26,27,28', 'speed': '25000', 'mtu': '9100'}, " - "'Ethernet108': {'alias': 'fortyGigE0/108', 'lanes': '81,82,83,84', 'mtu': '9100'}, " - "'Ethernet100': {'alias': 'fortyGigE0/100', 'lanes': '125,126,127,128', 'mtu': '9100'}, " - "'Ethernet104': {'alias': 'fortyGigE0/104', 'lanes': '85,86,87,88', 'mtu': '9100'}, " - "'Ethernet68': {'alias': 'fortyGigE0/68', 'lanes': '69,70,71,72', 'mtu': '9100'}, " - "'Ethernet96': {'alias': 'fortyGigE0/96', 'lanes': '121,122,123,124', 'mtu': '9100'}, " - "'Ethernet124': {'alias': 'fortyGigE0/124', 'lanes': '101,102,103,104', 'mtu': '9100'}, " - "'Ethernet92': {'alias': 'fortyGigE0/92', 'lanes': '113,114,115,116', 'mtu': '9100'}, " - "'Ethernet120': {'alias': 'fortyGigE0/120', 'lanes': '97,98,99,100', 'mtu': '9100'}, " - "'Ethernet52': {'alias': 'fortyGigE0/52', 'lanes': '53,54,55,56', 'mtu': '9100'}, " - "'Ethernet56': {'alias': 'fortyGigE0/56', 'lanes': '61,62,63,64', 'mtu': '9100'}, " - "'Ethernet76': {'alias': 'fortyGigE0/76', 'lanes': '73,74,75,76', 'mtu': '9100'}, " - "'Ethernet72': {'alias': 'fortyGigE0/72', 'lanes': '77,78,79,80', 'mtu': '9100'}, " - "'Ethernet64': {'alias': 'fortyGigE0/64', 'lanes': '65,66,67,68', 'mtu': '9100'}, " - "'Ethernet32': {'alias': 'fortyGigE0/32', 'lanes': '9,10,11,12', 'mtu': '9100'}, " - "'Ethernet16': {'alias': 'fortyGigE0/16', 'lanes': '41,42,43,44', 'mtu': '9100'}, " - "'Ethernet36': {'alias': 'fortyGigE0/36', 'lanes': '13,14,15,16', 'mtu': '9100'}, " - "'Ethernet12': {'lanes': '33,34,35,36', 'description': 'Interface description', 'mtu': '9100', 'alias': 'fortyGigE0/12', 'speed': '100000', 'fec': 'rs'}, " - "'Ethernet88': {'alias': 'fortyGigE0/88', 'lanes': '117,118,119,120', 'mtu': '9100'}, " - "'Ethernet116': {'alias': 'fortyGigE0/116', 'lanes': '93,94,95,96', 'mtu': '9100'}, " - "'Ethernet80': {'alias': 'fortyGigE0/80', 'lanes': '105,106,107,108', 'mtu': '9100'}, " - "'Ethernet112': {'alias': 'fortyGigE0/112', 'lanes': '89,90,91,92', 'mtu': '9100'}, " - "'Ethernet84': {'alias': 'fortyGigE0/84', 'lanes': '109,110,111,112', 'mtu': '9100'}, " - "'Ethernet48': {'alias': 'fortyGigE0/48', 'lanes': '49,50,51,52', 'mtu': '9100'}, " - "'Ethernet44': {'alias': 'fortyGigE0/44', 'lanes': '17,18,19,20', 'mtu': '9100'}, " - "'Ethernet40': {'alias': 'fortyGigE0/40', 'lanes': '21,22,23,24', 'mtu': '9100'}, " - "'Ethernet28': {'alias': 'fortyGigE0/28', 'lanes': '1,2,3,4', 'mtu': '9100'}, " - "'Ethernet60': {'alias': 'fortyGigE0/60', 'lanes': '57,58,59,60', 'mtu': '9100'}, " - "'Ethernet20': {'alias': 'fortyGigE0/20', 'lanes': '45,46,47,48', 'mtu': '9100'}, " - "'Ethernet24': {'alias': 'fortyGigE0/24', 'lanes': '5,6,7,8', 'mtu': '9100'}}") + "{'Ethernet8': {'lanes': '37,38,39,40', 'description': 'Interface description', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'speed': '1000'}, " + "'Ethernet0': {'lanes': '29,30,31,32', 'description': 'fortyGigE0/0', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/0', 'admin_status': 'up', 'speed': '10000'}, " + "'Ethernet4': {'lanes': '25,26,27,28', 'description': 'fortyGigE0/4', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/4', 'admin_status': 'up', 'speed': '25000'}, " + "'Ethernet108': {'alias': 'fortyGigE0/108', 'pfc_asym': 'off', 'lanes': '81,82,83,84', 'description': 'fortyGigE0/108', 'mtu': '9100'}, " + "'Ethernet100': {'alias': 'fortyGigE0/100', 'pfc_asym': 'off', 'lanes': '125,126,127,128', 'description': 'fortyGigE0/100', 'mtu': '9100'}, " + "'Ethernet104': {'alias': 'fortyGigE0/104', 'pfc_asym': 'off', 'lanes': '85,86,87,88', 'description': 'fortyGigE0/104', 'mtu': '9100'}, " + "'Ethernet68': {'alias': 'fortyGigE0/68', 'pfc_asym': 'off', 'lanes': '69,70,71,72', 'description': 'fortyGigE0/68', 'mtu': '9100'}, " + "'Ethernet96': {'alias': 'fortyGigE0/96', 'pfc_asym': 'off', 'lanes': '121,122,123,124', 'description': 'fortyGigE0/96', 'mtu': '9100'}, " + "'Ethernet124': {'alias': 'fortyGigE0/124', 'pfc_asym': 'off', 'lanes': '101,102,103,104', 'description': 'fortyGigE0/124', 'mtu': '9100'}, " + "'Ethernet92': {'alias': 'fortyGigE0/92', 'pfc_asym': 'off', 'lanes': '113,114,115,116', 'description': 'fortyGigE0/92', 'mtu': '9100'}, " + "'Ethernet120': {'alias': 'fortyGigE0/120', 'pfc_asym': 'off', 'lanes': '97,98,99,100', 'description': 'fortyGigE0/120', 'mtu': '9100'}, " + "'Ethernet52': {'alias': 'fortyGigE0/52', 'pfc_asym': 'off', 'lanes': '53,54,55,56', 'description': 'fortyGigE0/52', 'mtu': '9100'}, " + "'Ethernet56': {'alias': 'fortyGigE0/56', 'pfc_asym': 'off', 'lanes': '61,62,63,64', 'description': 'fortyGigE0/56', 'mtu': '9100'}, " + "'Ethernet76': {'alias': 'fortyGigE0/76', 'pfc_asym': 'off', 'lanes': '73,74,75,76', 'description': 'fortyGigE0/76', 'mtu': '9100'}, " + "'Ethernet72': {'alias': 'fortyGigE0/72', 'pfc_asym': 'off', 'lanes': '77,78,79,80', 'description': 'fortyGigE0/72', 'mtu': '9100'}, " + "'Ethernet64': {'alias': 'fortyGigE0/64', 'pfc_asym': 'off', 'lanes': '65,66,67,68', 'description': 'fortyGigE0/64', 'mtu': '9100'}, " + "'Ethernet32': {'alias': 'fortyGigE0/32', 'pfc_asym': 'off', 'lanes': '9,10,11,12', 'description': 'fortyGigE0/32', 'mtu': '9100'}, " + "'Ethernet16': {'alias': 'fortyGigE0/16', 'pfc_asym': 'off', 'lanes': '41,42,43,44', 'description': 'fortyGigE0/16', 'mtu': '9100'}, " + "'Ethernet36': {'alias': 'fortyGigE0/36', 'pfc_asym': 'off', 'lanes': '13,14,15,16', 'description': 'fortyGigE0/36', 'mtu': '9100'}, " + "'Ethernet12': {'lanes': '33,34,35,36', 'fec': 'rs', 'mtu': '9100', 'alias': 'fortyGigE0/12', 'pfc_asym': 'off', 'speed': '100000', 'description': 'Interface description'}, " + "'Ethernet88': {'alias': 'fortyGigE0/88', 'pfc_asym': 'off', 'lanes': '117,118,119,120', 'description': 'fortyGigE0/88', 'mtu': '9100'}, " + "'Ethernet116': {'alias': 'fortyGigE0/116', 'pfc_asym': 'off', 'lanes': '93,94,95,96', 'description': 'fortyGigE0/116', 'mtu': '9100'}, " + "'Ethernet80': {'alias': 'fortyGigE0/80', 'pfc_asym': 'off', 'lanes': '105,106,107,108', 'description': 'fortyGigE0/80', 'mtu': '9100'}, " + "'Ethernet112': {'alias': 'fortyGigE0/112', 'pfc_asym': 'off', 'lanes': '89,90,91,92', 'description': 'fortyGigE0/112', 'mtu': '9100'}, " + "'Ethernet84': {'alias': 'fortyGigE0/84', 'pfc_asym': 'off', 'lanes': '109,110,111,112', 'description': 'fortyGigE0/84', 'mtu': '9100'}, " + "'Ethernet48': {'alias': 'fortyGigE0/48', 'pfc_asym': 'off', 'lanes': '49,50,51,52', 'description': 'fortyGigE0/48', 'mtu': '9100'}, " + "'Ethernet44': {'alias': 'fortyGigE0/44', 'pfc_asym': 'off', 'lanes': '17,18,19,20', 'description': 'fortyGigE0/44', 'mtu': '9100'}, " + "'Ethernet40': {'alias': 'fortyGigE0/40', 'pfc_asym': 'off', 'lanes': '21,22,23,24', 'description': 'fortyGigE0/40', 'mtu': '9100'}, " + "'Ethernet28': {'alias': 'fortyGigE0/28', 'pfc_asym': 'off', 'lanes': '1,2,3,4', 'description': 'fortyGigE0/28', 'mtu': '9100'}, " + "'Ethernet60': {'alias': 'fortyGigE0/60', 'pfc_asym': 'off', 'lanes': '57,58,59,60', 'description': 'fortyGigE0/60', 'mtu': '9100'}, " + "'Ethernet20': {'alias': 'fortyGigE0/20', 'pfc_asym': 'off', 'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'mtu': '9100'}, " + "'Ethernet24': {'alias': 'fortyGigE0/24', 'pfc_asym': 'off', 'lanes': '5,6,7,8', 'description': 'fortyGigE0/24', 'mtu': '9100'}}") def test_metadata_everflow(self): argument = '-m "' + self.sample_graph_metadata + '" -p "' + self.port_config + '" -v "MIRROR_SESSION"' diff --git a/src/sonic-dbsyncd b/src/sonic-dbsyncd index 1cdcffc08f6e..fe60afa7e24a 160000 --- a/src/sonic-dbsyncd +++ b/src/sonic-dbsyncd @@ -1 +1 @@ -Subproject commit 1cdcffc08f6ea1c3fc53f7aeeef5b5632124496f +Subproject commit fe60afa7e24a7053a7bd9d7084268c1bbd203208 diff --git a/src/sonic-device-data/tests/config_checker b/src/sonic-device-data/tests/config_checker index 6e59d1f44ce4..12f1b378099a 100755 --- a/src/sonic-device-data/tests/config_checker +++ b/src/sonic-device-data/tests/config_checker @@ -13,6 +13,10 @@ def check_property(p): if p in permitted_properties: return True + + if re.sub(r"{[0-9]+}", "", p) in permitted_properties: + return True + return False def check_file(file_name): @@ -46,6 +50,7 @@ def check_file(file_name): # Remove trailing "{.}$" p = re.sub(r"{[0-9]+\.[0-9]+}$", '', p) + if not check_property(p): file_ok = False print("[line %d] Error: %s is not permitted" % (lineno, p)) diff --git a/src/sonic-device-data/tests/permitted_list b/src/sonic-device-data/tests/permitted_list index ba07b29c0cc7..b1d3cc6d04b1 100644 --- a/src/sonic-device-data/tests/permitted_list +++ b/src/sonic-device-data/tests/permitted_list @@ -140,3 +140,25 @@ xgxs_lcpll_xtal_refclk xgxs_pdetect xgxs_rx_lane_map xgxs_tx_lane_map +ccm_dma_enable +ccmdma_intr_enable +phy_enable +phy_null +pll_bypass +init_all_modules +serdes_core_tx_polarity_flip_physical +serdes_core_rx_polarity_flip_physical +dpr_clock_frequency +device_clock_frequency +port_flex_enable +help_cli_enable +ifp_inports_support_enable +memlist_enable +pbmp_gport_stack +reglist_enable +cls_cmd_daemon +serdes_lane_config_dfe +serdes_fec_enable +port_fec +serdes_tx_taps +scache_filename diff --git a/src/sonic-platform-common b/src/sonic-platform-common index d4bf78c9db4d..42119e19030e 160000 --- a/src/sonic-platform-common +++ b/src/sonic-platform-common @@ -1 +1 @@ -Subproject commit d4bf78c9db4daf21497274a778748da4d8301866 +Subproject commit 42119e19030e33e8857f31f7a88d079fbe8edea9 diff --git a/src/sonic-py-swsssdk b/src/sonic-py-swsssdk index cb4fec9d078f..4cee38534919 160000 --- a/src/sonic-py-swsssdk +++ b/src/sonic-py-swsssdk @@ -1 +1 @@ -Subproject commit cb4fec9d078f72ca378ecba5e6a112e3028c2221 +Subproject commit 4cee38534919e34f407363ac3ab5f31b4d09be6d diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 60f97c33ccb5..74f0f44bd790 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 60f97c33ccb5b218c68b8c3fe94a48719ed09435 +Subproject commit 74f0f44bd7906b27d6e080614784919079afb66b diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index dd9a8ea1406e..26f04959a205 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit dd9a8ea1406e37531bd92dd08223d2813560a6f6 +Subproject commit 26f04959a205d6493da8e3f989ae3803338aa2d7 diff --git a/src/sonic-swss b/src/sonic-swss index 8c8779a06263..ae74a27df766 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 8c8779a062631ec5396858d3bac64b9a53d2cb7c +Subproject commit ae74a27df766321e0802f8bb38e9fa41dadffd88 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index e8caaead527d..24c0ff7215e0 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit e8caaead527d46d42e41e99b884f41c57f70018b +Subproject commit 24c0ff7215e0fd13e9247bda6a4f92862b8519da diff --git a/src/sonic-utilities b/src/sonic-utilities index 3ce8952ca43c..6aee909259e4 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 3ce8952ca43c2d5015ae90b13aa8a4644bab4c19 +Subproject commit 6aee909259e4539c9d0a811fce8533a867f45090 diff --git a/src/supervisor/patch/0002-Add-unit-test-cases-to-ensure-state-transitions-work.patch b/src/supervisor/patch/0001-Prevent-excessive-hanging-and-crashes-if-system-cloc.patch similarity index 54% rename from src/supervisor/patch/0002-Add-unit-test-cases-to-ensure-state-transitions-work.patch rename to src/supervisor/patch/0001-Prevent-excessive-hanging-and-crashes-if-system-cloc.patch index cb01665ba80b..6c4a6b7c2a4c 100644 --- a/src/supervisor/patch/0002-Add-unit-test-cases-to-ensure-state-transitions-work.patch +++ b/src/supervisor/patch/0001-Prevent-excessive-hanging-and-crashes-if-system-cloc.patch @@ -1,15 +1,91 @@ -From 43b6f3ee93593f666af2c6a7af897bf3b5ee762d Mon Sep 17 00:00:00 2001 +From 5b56519e68e866662d9fd9a6681b6b47d6b5fcdb Mon Sep 17 00:00:00 2001 From: Joe LeVeque -Date: Wed, 17 Jan 2018 22:27:56 +0000 -Subject: [PATCH 2/2] Add unit test cases to ensure state transitions work if - system time has rolled backward +Date: Thu, 28 Feb 2019 01:43:54 +0000 +Subject: [PATCH] Prevent excessive hanging and crashes if system clock rolls + backward --- - supervisor/tests/test_process.py | 146 +++++++++++++++++++++++++++++++++++++++ - 1 file changed, 146 insertions(+) + supervisor/process.py | 36 ++++++ + supervisor/tests/test_process.py | 183 +++++++++++++++++++++++++++++++ + 2 files changed, 219 insertions(+) +diff --git a/supervisor/process.py b/supervisor/process.py +index f9ddcd9..5f73e6b 100644 +--- a/supervisor/process.py ++++ b/supervisor/process.py +@@ -347,6 +347,28 @@ class Subprocess: + options.write(2, "supervisor: child process was not spawned\n") + options._exit(127) # exit process with code for spawn failure + ++ def _check_and_adjust_for_system_clock_rollback(self, test_time): ++ """ ++ Check if system clock has rolled backward beyond test_time. If so, set ++ affected timestamps to test_time. ++ """ ++ if self.state == ProcessStates.STARTING: ++ if test_time < self.laststart: ++ self.laststart = test_time; ++ if self.delay > 0 and test_time < (self.delay - self.config.startsecs): ++ self.delay = test_time + self.config.startsecs ++ elif self.state == ProcessStates.RUNNING: ++ if test_time > self.laststart and test_time < (self.laststart + self.config.startsecs): ++ self.laststart = test_time - self.config.startsecs ++ elif self.state == ProcessStates.STOPPING: ++ if test_time < self.laststopreport: ++ self.laststopreport = test_time; ++ if self.delay > 0 and test_time < (self.delay - self.config.stopwaitsecs): ++ self.delay = test_time + self.config.stopwaitsecs ++ elif self.state == ProcessStates.BACKOFF: ++ if self.delay > 0 and test_time < (self.delay - self.backoff): ++ self.delay = test_time + self.backoff ++ + def stop(self): + """ Administrative stop """ + self.administrative_stop = True +@@ -357,6 +379,9 @@ class Subprocess: + """ Log a 'waiting for x to stop' message with throttling. """ + if self.state == ProcessStates.STOPPING: + now = time.time() ++ ++ self._check_and_adjust_for_system_clock_rollback(now) ++ + if now > (self.laststopreport + 2): # every 2 seconds + self.config.options.logger.info( + 'waiting for %s to stop' % self.config.name) +@@ -487,6 +512,9 @@ class Subprocess: + es, msg = decode_wait_status(sts) + + now = time.time() ++ ++ self._check_and_adjust_for_system_clock_rollback(now) ++ + self.laststop = now + processname = self.config.name + +@@ -586,6 +614,8 @@ class Subprocess: + now = time.time() + state = self.state + ++ self._check_and_adjust_for_system_clock_rollback(now) ++ + logger = self.config.options.logger + + if self.config.options.mood > SupervisorStates.RESTARTING: +@@ -805,6 +835,12 @@ class EventListenerPool(ProcessGroupBase): + if dispatch_capable: + if self.dispatch_throttle: + now = time.time() ++ ++ if now < self.last_dispatch: ++ # The system clock appears to have moved backward ++ # Reset self.last_dispatch accordingly ++ self.last_dispatch = now; ++ + if now - self.last_dispatch < self.dispatch_throttle: + return + self.dispatch() diff --git a/supervisor/tests/test_process.py b/supervisor/tests/test_process.py -index 7f9bab2..ea16315 100644 +index 7f9bab2..6808f60 100644 --- a/supervisor/tests/test_process.py +++ b/supervisor/tests/test_process.py @@ -736,6 +736,40 @@ class SubprocessTests(unittest.TestCase): @@ -53,7 +129,51 @@ index 7f9bab2..ea16315 100644 def test_give_up(self): options = DummyOptions() config = DummyPConfig(options, 'test', '/test') -@@ -1402,6 +1436,92 @@ class SubprocessTests(unittest.TestCase): +@@ -1105,6 +1139,43 @@ class SubprocessTests(unittest.TestCase): + self.assertEqual(event.__class__, events.ProcessStateBackoffEvent) + self.assertEqual(event.from_state, ProcessStates.STARTING) + ++ # This tests the case where the process has stayed alive longer than ++ # startsecs (i.e., long enough to enter the RUNNING state), however the ++ # system clock has since rolled backward such that the current time is ++ # greater than laststart but less than startsecs. ++ def test_finish_running_state_exited_too_quickly_due_to_clock_rollback(self): ++ options = DummyOptions() ++ config = DummyPConfig(options, 'notthere', '/notthere', ++ stdout_logfile='/tmp/foo', startsecs=10) ++ instance = self._makeOne(config) ++ instance.config.options.pidhistory[123] = instance ++ pipes = {'stdout':'','stderr':''} ++ instance.pipes = pipes ++ instance.config.exitcodes =[-1] ++ instance.laststart = time.time() ++ from supervisor.states import ProcessStates ++ from supervisor import events ++ instance.state = ProcessStates.RUNNING ++ L = [] ++ events.subscribe(events.ProcessStateEvent, lambda x: L.append(x)) ++ instance.pid = 123 ++ instance.finish(123, 1) ++ self.assertFalse(instance.killing) ++ self.assertEqual(instance.pid, 0) ++ self.assertEqual(options.parent_pipes_closed, pipes) ++ self.assertEqual(instance.pipes, {}) ++ self.assertEqual(instance.dispatchers, {}) ++ self.assertEqual(options.logger.data[0], ++ 'exited: notthere (terminated by SIGHUP; expected)') ++ self.assertEqual(instance.exitstatus, -1) ++ self.assertEqual(len(L), 1) ++ event = L[0] ++ self.assertEqual(event.__class__, ++ events.ProcessStateExitedEvent) ++ self.assertEqual(event.expected, True) ++ self.assertEqual(event.extra_values, [('expected', True), ('pid', 123)]) ++ self.assertEqual(event.from_state, ProcessStates.RUNNING) ++ + def test_finish_running_state_laststart_in_future(self): + options = DummyOptions() + config = DummyPConfig(options, 'notthere', '/notthere', +@@ -1402,6 +1473,92 @@ class SubprocessTests(unittest.TestCase): event = L[0] self.assertEqual(event.__class__, events.ProcessStateRunningEvent) @@ -146,7 +266,7 @@ index 7f9bab2..ea16315 100644 def test_transition_backoff_to_fatal(self): from supervisor import events L = [] -@@ -2033,6 +2153,32 @@ class EventListenerPoolTests(ProcessGroupBaseTests): +@@ -2033,6 +2190,32 @@ class EventListenerPoolTests(ProcessGroupBaseTests): self.assertEqual(process1.listener_state, EventListenerStates.BUSY) self.assertEqual(process1.event, event) @@ -180,5 +300,5 @@ index 7f9bab2..ea16315 100644 options = DummyOptions() from supervisor.states import ProcessStates -- -2.1.4 +2.17.1 diff --git a/src/supervisor/patch/0001-Prevent-excessive-hanging-delays-in-process-state-tr.patch b/src/supervisor/patch/0001-Prevent-excessive-hanging-delays-in-process-state-tr.patch deleted file mode 100644 index c0263e9baf10..000000000000 --- a/src/supervisor/patch/0001-Prevent-excessive-hanging-delays-in-process-state-tr.patch +++ /dev/null @@ -1,83 +0,0 @@ -From bac496af4c2051b3c15038e06533f9094b1c3604 Mon Sep 17 00:00:00 2001 -From: Joe LeVeque -Date: Tue, 16 Jan 2018 20:42:13 +0000 -Subject: [PATCH 1/2] Prevent excessive hanging/delays in process state - transitions if the system time rolls backward - ---- - supervisor/process.py | 32 ++++++++++++++++++++++++++++++++ - 1 file changed, 32 insertions(+) - -diff --git a/supervisor/process.py b/supervisor/process.py -index f9ddcd9..216372f 100644 ---- a/supervisor/process.py -+++ b/supervisor/process.py -@@ -357,6 +357,12 @@ class Subprocess: - """ Log a 'waiting for x to stop' message with throttling. """ - if self.state == ProcessStates.STOPPING: - now = time.time() -+ -+ # If the system clock has moved backward, reset -+ # self.laststopreport to current system time -+ if now < self.laststopreport: -+ self.laststopreport = now; -+ - if now > (self.laststopreport + 2): # every 2 seconds - self.config.options.logger.info( - 'waiting for %s to stop' % self.config.name) -@@ -604,12 +610,27 @@ class Subprocess: - # STOPPED -> STARTING - self.spawn() - elif state == ProcessStates.BACKOFF: -+ if self.delay > 0 and now < self.delay - self.backoff: -+ # The system clock appears to have moved backward -+ # Reset self.delay accordingly -+ self.delay = now + self.backoff -+ - if self.backoff <= self.config.startretries: - if now > self.delay: - # BACKOFF -> STARTING - self.spawn() - - if state == ProcessStates.STARTING: -+ if now < self.laststart: -+ # The system clock appears to have moved backward -+ # Reset self.laststart to current system time -+ self.laststart = now; -+ -+ if self.delay > 0 and now < self.delay - self.config.startsecs: -+ # The system clock appears to have moved backward -+ # Reset self.delay accordingly -+ self.delay = now + self.config.startsecs -+ - if now - self.laststart > self.config.startsecs: - # STARTING -> RUNNING if the proc has started - # successfully and it has stayed up for at least -@@ -633,6 +654,11 @@ class Subprocess: - logger.info('gave up: %s %s' % (self.config.name, msg)) - - elif state == ProcessStates.STOPPING: -+ if self.delay > 0 and now < self.delay - self.config.stopwaitsecs: -+ # The system clock appears to have moved backward -+ # Reset self.delay accordingly -+ self.delay = now + self.config.stopwaitsecs -+ - time_left = self.delay - now - if time_left <= 0: - # kill processes which are taking too long to stop with a final -@@ -805,6 +831,12 @@ class EventListenerPool(ProcessGroupBase): - if dispatch_capable: - if self.dispatch_throttle: - now = time.time() -+ -+ # If the system clock has moved backward, reset -+ # self.last_dispatch to current system time -+ if now < self.last_dispatch: -+ self.last_dispatch = now; -+ - if now - self.last_dispatch < self.dispatch_throttle: - return - self.dispatch() --- -2.1.4 - diff --git a/src/supervisor/patch/series b/src/supervisor/patch/series index d141fddf3301..9d87dccfa780 100644 --- a/src/supervisor/patch/series +++ b/src/supervisor/patch/series @@ -1,2 +1,2 @@ -0001-Prevent-excessive-hanging-delays-in-process-state-tr.patch -0002-Add-unit-test-cases-to-ensure-state-transitions-work.patch +# This series applies on GIT commit 34b690aea8cf7572d73765c95c54a83261d69aad +0001-Prevent-excessive-hanging-and-crashes-if-system-cloc.patch